在包javax.lang.model.type
中,我们有基本的枚举TypeKind
。
public enum TypeKind {
BOOLEAN,
BYTE,
SHORT,
INT,
LONG,
CHAR,
FLOAT,
DOUBLE,
VOID,
NONE,
NULL,
ARRAY,
DECLARED,
ERROR,
TYPEVAR,
WILDCARD,
PACKAGE,
EXECUTABLE,
OTHER,
UNION;
public boolean More ...isPrimitive() {
switch(this) {
case BOOLEAN:
case BYTE:
case SHORT:
case INT:
case LONG:
case CHAR:
case FLOAT:
case DOUBLE:
return true;
default:
return false;
}
}
}
继承自javax.lang.model.type.ReferenceType
的接口javax.lang.model.type.MirrorType
。 javax.lang.model.type.NullType
继承自javax.lang.model.type.ReferenceType
。因此,基本上,我们有一组类型,其中八个是原始的,两个伪类型(VOID
,NONE
)和一些其他类型,其中NullType
和{{1} }。
问题:据我了解WildcardType
表达式只是null
接口的实现。我可以在哪里找到接口NullType
的实现,即我想知道NullType
表达式是什么?
在包null
中,我们有课程sun.reflect.generics.reflectiveObjects
。这个类私有字段:
WildcardTypeImpl
问题如果我们使用带扩展名为private Type[] upperBounds;
private Type[] lowerBounds;
的通配符,那么我们的topBounds将是NullType和List<? extends Integer> ints;
的实现。
lowerBounds=Integer
接口不从接口WildcardType
继承。但是如果我们使用带有超级ReferenceType
的通配符,我们可以向int添加元素。我不明白这一点。