![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
翻译
文章平均质量分 91
lixp9
这个作者很懒,什么都没留下…
展开
-
Java泛型中类型信息的擦除
public class Erased{ private final int SIZE = 100; public static void f(Object arg){ if(arg instanceof T){} //Error T var = new T();//Error T[] array = new T[SIZE];//Error T[] array = (T)new Object[SIZE];//Unchecked warning }}翻译 2010-09-13 20:42:00 · 586 阅读 · 0 评论 -
Security
Aside from platform independence, discussed in the previous chapter, the other major technical challenge a network-oriented software technology must deal with is security. Networks, because they allow computers to share data and distribute processing,翻译 2010-09-10 19:05:00 · 352 阅读 · 0 评论 -
Why security
Java's security model is one of the key architectural features that makes it an appropriate technology for networked environments. Security is important because networks represent a potential avenue of attack to any computer hooked to them. This concern翻译 2010-09-11 17:54:00 · 483 阅读 · 0 评论 -
no-generic code
在没有泛型的代码中,参数类型不能随着子类型变化,而变化: class OrdinarySetter{ void set(Base base){ System.out.println("OrdinarySetter.set(Base)"); } } class DerivedSetter extends OrdinarySetter{ void set(Derived derived){ System.out.println("DerivedSetter.set(Deri翻译 2010-09-20 15:04:00 · 423 阅读 · 0 评论 -
泛型中的异常处理
<br /> 由于存在类型擦除,泛型中异常的处理受到限制。由于异常的类型必须在编译或运行时,确切知晓,否则,异常无法被捕获。泛型类型通常不能直接的或者间接的继承Throwable,这进一步阻止了你处理不能被捕获的异常。<br /> 尽管如此,类型参数还是被用在方法声明的异常语句中的,他允许你通过检查类型信息来写泛型的代码<br /> interface Processor<T,E extends Exception>{<br /> void process(List<T> res翻译 2010-09-20 17:03:00 · 592 阅读 · 1 评论 -
混型
由于存在类型擦除,泛型中异常的处理受到限制。由于异常的类型必须在编译或运行时,确切知晓,否则,异常无法被捕获。泛型类型通常不能直接的或者间接的继承Throwable,这进一步阻止了你处理不能被捕获的异常。 尽管如此,类型参数还是被用在方法声明的异常语句中的,他允许你通过检查类型信息来写泛型的代码 interface Processor{ void process(List resultCollector) throw E;} class ProcessRunner exte翻译 2010-09-21 15:44:00 · 771 阅读 · 0 评论 -
动态代理混合
<br />用动态代理可能产生一种比装饰器模式更接近混型模式的机制,用动态代理,产生的类型就是已经被混合后产生的组合类型。由于动态代理的限制,每个参与混型的类都必须实现某个或某些接口。<br />class MixinProxy implements InvocationHandler{<br /> Map<String,Object> delegatesByMethod;<br /> public MinxinProxy(TwoTuple<Object,Class<?>>...pairs){<br /翻译 2010-09-23 12:59:00 · 424 阅读 · 0 评论