另外还需要注意,Root是泛型的(实际上每个表达式都是泛型的)。
Also notice that Root is generically typed. (Actually, every expression is.)
从属类型是运行时值参数化的类型(与泛型比较,泛型是其它类型参数化的类型)。
Dependent types are types parameterized by run-time values (compare this with generic types, which are parameterized by other types).
提取通用行为并把它们包含在泛型DAO 中,让类的所有用户通过泛型 DAO访问这些功能,这样就可以减少代码重复。
You can reduce code duplication by abstracting the common behavior and including it in the generic DAO, where all users of the class will have access to the functionality.
正如我在前一期中介绍的,签名是泛型添加到类文件格式中的项目;只有对泛型的引用才有签名。
As I covered in the last column, signatures are an item added to the class file format by generics; only references to generic types have signatures.
要想在不将类载入JVM的情况下访问泛型信息,您需要一种读取存储在二进制类表示内的泛型信息的方法。
To access generics information without loading classes into the JVM, you need a way of reading the generics information stored inside the binary class representation.
答案取决于这样的事实,您常常需要创建泛型库,以及对于某些具体类型,您希望避免泛型行为和拥有特殊化的实现。
The answer lies in the fact that you often need to create generic libraries, and for some specific types, you want to avoid the generic behavior and have a specialized implementation.
因为我想在这一期中演示泛型的解码,所以类型信息需要包含泛型引用所使用的具体的参数类型。
Because I want to demonstrate decoding generic types for this column, the type information needs to include the specific parameter types used with a generic type reference.
比如泛型更改——泛型类型信息——由编译器用于实施编译时安全,但是生成的字节码仍然到处使用强制转换。
Likewise with the generics changes — the generic type information is used by the compiler to enforce compile-time safe usage, but the generated bytecode still USES casts everywhere.
就像泛型类的类型参数用尖括号括起来那样,泛型类型应用程序的参数也是用尖括号括起来的。
Just as the type parameters of a generic class are wrapped in Angle brackets, the arguments of a generic type application are wrapped in Angle brackets as well.
一部分人认为泛型简化了编程,扩展了类型系统从而使编译器能够检验类型安全;另外一些人认为泛型添加了很多不必要的复杂性。
Some say they simplify programming by extending the reach of the type system and therefore the compiler's ability to verify type safety; others say that they add more complexity than they're worth.
运行时缺乏类型信息,这给泛型容器类和希望创建保护性副本的泛型类提出了难题。
This lack of type information at runtime poses a problem for generic container classes and for generic classes that want to make defensive copies.
在使用泛型DAO的过程中,您会发现新的通用操作,可以把它们添加到泛型DAO中,从而增强可重用性并减少重复。
As you use the generic DAO, you'll start to see new common operations that you can add to the generic DAO to increase reusability and decrease duplication.
不是泛型引用的字段都在泛型模型定义的时候完全定义;是泛型引用的字段则保留作为签名,留在以后进行填充。
Fields that aren't generic references are fully defined at the time the generic template is defined; fields that are generic references are just kept as signatures to be filled in later.
在框架内部的重要重构使用了泛型集合类代替非泛型的集合性。
Major refactoring internally to use generic collections instead of the non generic types.
要提高泛型代码的有效性,可以指定一个上限(或下限),而不是指定某个泛型类型参数的精确类型。 这可以使用有界通配符来实现,它的形式为 “?
To increase the usefulness of our generic code, instead of specifying the exact type of a generic type parameter, we can specify an upper (or lower) bound instead.
基于对泛型的了解,你可以发现没有理由不在这段代码里替换类型参数为泛型里典型的'T '。
With an understanding of Generics, you can see that there should be no reason to replace the type arguments in this block of code with the typical 't' found in Generics.
再提一次,那是因为一个泛型类可以用其自己的类型参数来实例化另一个泛型类。
Again, that's because one generic class may instantiate another with its own type parameters.
最后随着越来越多的人掌握了泛型编程的技巧,他们才发现泛型确实很难用。
Lately more and more people have gained enough experience with Generics to see that they really are very hard to use.
事实上,我们甚至可以交替地使用非泛型的旧类(比如List)和其对应的泛型类(List);两者在运行时看起来是一样的。
In fact, we can even use non-generic legacy classes such as List with their generic counterparts (List) interchangeably; both look the same at runtime.
我们还说明了为Tiger制定的泛型类型的实现怎么会包含数个“缺陷”,这些缺陷限制了可以使用泛型类型的上下文。
We also touched upon how the incarnation of generic types scheduled for Tiger includes several "kinks" that limit the contexts in which generic types can be used.
为了通过泛型类型支持mixin,我们需要获得泛型类型实例化的运行时表示。
To support mixins through generic types, we need to have run-time representations of the generic type instantiations available.
如果一个类或方法同时提供泛型和非泛型实现,总是选择使用泛型实现。
If a class or a method offers both generic and non generic flavors, always prefer using the generics flavor.
您可以使用非泛型基接口间接访问泛型类。
You can access a generic class indirectly using a nongeneric base interface.
请注意,方法不会仅因为在泛型类型中声明而成为泛型方法。
Note that a method is not generic just because it is declared in a generic type.
许多泛型集合类型是非泛型类型的直接模拟。
Many of the generic collection types are direct analogs of nongeneric types.
一个静态的泛型和非泛型类工厂方法?
A static factory method on a generic or a non-generic class?
创建泛型类型参数的定义,并获取该泛型类型参数的标记。
Each parameter definition consists of a parameter name and a data type.
泛型参数也可以允许在方法和构造中定义,-这时方法和构造就被称之谓泛型方法和泛型参数。
Type parameters can also be declared within method and constructor signatures to create generic methods and generic constructors.
泛型机制应该支持泛型的限定性形态。
The genericity mechanism should support the constrained form of genericity.
针对泛型技术的特点,该文提出了一种增强的覆盖度量方法,该方法可用于泛型程序的白盒测试。
Aiming at generic technologys characters, this paper puts forward a kind of enhanced coverage metrics, which can be used in generic programs white-box test.
应用推荐