Package org.aspectj.weaver
Class UnresolvedType
java.lang.Object
org.aspectj.weaver.UnresolvedType
- All Implemented Interfaces:
Traceable
,TypeVariableDeclaringElement
- Direct Known Subclasses:
ResolvedType
,UnresolvedTypeVariableReferenceType
,WildcardedUnresolvedType
A UnresolvedType represents a type to the weaver. UnresolvedTypes are resolved in some World (a type repository). When a
UnresolvedType is resolved it turns into a ResolvedType which may be a primitive type, or a ReferenceType. ReferenceTypes may
refer to simple, generic, parameterized or type-variable based reference types. A ReferenceType is backed by a delegate that
provides information about the type based on some repository (for example an Eclipse based delegate, a bytecode based delegate or
a reflection based delegate).
Every UnresolvedType has a signature, the unique key for the type in the world.
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionstatic UnresolvedType
static UnresolvedType
static UnresolvedType[]
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static String
static UnresolvedType[]
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
static UnresolvedType
protected String
protected String
The erasure of the signature.static UnresolvedType
static UnresolvedType
static UnresolvedType
protected UnresolvedType.TypeKind
protected UnresolvedType[]
Iff isParameterized(), then these are the type parametersprotected TypeVariable[]
Iff isGeneric(), then these are the type variables declared on the type Iff isParameterized(), then these are the type variables bound as parameters in the typestatic UnresolvedType
-
Constructor Summary
ModifierConstructorDescriptionprotected
UnresolvedType(String signature)
protected
UnresolvedType(String signature, String signatureErasure)
UnresolvedType(String signature, String signatureErasure, UnresolvedType[] typeParams)
-
Method Summary
Modifier and TypeMethodDescriptionstatic UnresolvedType[]
add(UnresolvedType[] types, UnresolvedType end)
Creates a new type array with a fresh type appended to the end.boolean
Equality is checked based on the underlying signature.static UnresolvedType
forGenericType(String name, TypeVariable[] tvbs, String genericSig)
static UnresolvedType
forGenericTypeSignature(String sig, String declaredGenericSig)
static UnresolvedType
forGenericTypeVariables(String sig, TypeVariable[] tVars)
static UnresolvedType
NOTE: Use forSignature() if you can, it'll be cheaper !static UnresolvedType[]
Constructs a UnresolvedType for each java language type name in an incoming array.static UnresolvedType
forPrimitiveType(String signature)
static UnresolvedType
forRawTypeName(String name)
static UnresolvedType
forSignature(String signature)
Constructs a Type for a JVM bytecode signature string.static UnresolvedType[]
forSignatures(String[] sigs)
Constructs a UnresolvedType for each JVM bytecode type signature in an incoming array.Returns a UnresolvedType object representing the component type of this array, or null if this type does not represent an array type.For parameterized types, return the signature for the raw typegetName()
Returns the name of this type in java language form (e.g. java.lang.Thread or boolean[]).static String[]
getNames(UnresolvedType[] types)
Returns an array of strings representing the java langauge names of an array of types.Returns a UnresolvedType object representing the effective outermost enclosing type for a name type.Returns the name of this type in JVM signature form.int
getSize()
This is the size of this type as used in JVM.getTypeVariableNamed(String name)
int
hashCode()
Equality is checked based on the underlying signature, so the hash code of a particular type is the hash code of its signature string.static UnresolvedType[]
insert(UnresolvedType start, UnresolvedType[] types)
Creates a new type array with a fresh type inserted at the beginning.boolean
isArray()
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
boolean
isVoid()
static UnresolvedType
makeArray(UnresolvedType base, int dims)
boolean
parameterize(Map<String,UnresolvedType> typeBindings)
Return a version of this parameterized type in which any type parameters that are type variable references are replaced by their matching type variable binding.static UnresolvedType
read(DataInputStream s)
Read in an UnresolvedType - just read the signature and rebuild the UnresolvedType.static UnresolvedType[]
Returns a resolved version of this type according to a particular world.void
setNeedsModifiableDelegate(boolean b)
toString()
Returns a java language string representation of this type.void
Write out an UnresolvedType - the signature should be enough.static void
writeArray(UnresolvedType[] types, CompressingDataOutputStream stream)
-
Field Details
-
NONE
-
OBJECT
-
OBJECTARRAY
-
CLONEABLE
-
SERIALIZABLE
-
THROWABLE
-
RUNTIME_EXCEPTION
-
ERROR
-
AT_INHERITED
-
AT_RETENTION
-
ENUM
-
ANNOTATION
-
JL_CLASS
-
JAVA_LANG_CLASS_ARRAY
-
JL_STRING
-
JL_EXCEPTION
-
JAVA_LANG_REFLECT_METHOD
-
JAVA_LANG_REFLECT_FIELD
-
JAVA_LANG_REFLECT_CONSTRUCTOR
-
JAVA_LANG_ANNOTATION
-
SUPPRESS_AJ_WARNINGS
-
AT_TARGET
-
SOMETHING
-
ARRAY_WITH_JUST_OBJECT
-
JOINPOINT_STATICPART
-
JOINPOINT_ENCLOSINGSTATICPART
-
AJC_PRIVILEGED
-
PROCEEDING_JOINPOINT
-
BOOLEAN
-
BYTE
-
CHAR
-
DOUBLE
-
FLOAT
-
INT
-
LONG
-
SHORT
-
VOID
-
MISSING_NAME
- See Also:
- Constant Field Values
-
typeKind
-
signature
-
signatureErasure
The erasure of the signature. Contains only the Java signature of the type with all supertype, superinterface, type variable, and parameter information removed. -
typeParameters
Iff isParameterized(), then these are the type parameters -
typeVariables
Iff isGeneric(), then these are the type variables declared on the type Iff isParameterized(), then these are the type variables bound as parameters in the type
-
-
Constructor Details
-
UnresolvedType
-
UnresolvedType
-
UnresolvedType
-
-
Method Details
-
isPrimitiveType
public boolean isPrimitiveType() -
isVoid
public boolean isVoid() -
isSimpleType
public boolean isSimpleType() -
isRawType
public boolean isRawType() -
isGenericType
public boolean isGenericType() -
isParameterizedType
public boolean isParameterizedType() -
isParameterizedOrGenericType
public boolean isParameterizedOrGenericType() -
isParameterizedOrRawType
public boolean isParameterizedOrRawType() -
isTypeVariableReference
public boolean isTypeVariableReference() -
isGenericWildcard
public boolean isGenericWildcard() -
getTypekind
-
isArray
public final boolean isArray() -
equals
Equality is checked based on the underlying signature. -
hashCode
public int hashCode()Equality is checked based on the underlying signature, so the hash code of a particular type is the hash code of its signature string. -
getSize
public int getSize()This is the size of this type as used in JVM. -
forName
NOTE: Use forSignature() if you can, it'll be cheaper ! Constructs a UnresolvedType for a java language type name. For example:UnresolvedType.forName("java.lang.Thread[]") UnresolvedType.forName("int")
forSignature(String)
.UnresolvedType.forName("java.lang.Thread[]").equals(Type.forSignature("[Ljava/lang/Thread;") UnresolvedType.forName("int").equals(Type.forSignature("I"))
- Parameters:
name
- the java language type name in question.- Returns:
- a type object representing that java language type.
-
forNames
Constructs a UnresolvedType for each java language type name in an incoming array.- Parameters:
names
- an array of java language type names.- Returns:
- an array of UnresolvedType objects.
- See Also:
forName(String)
-
forGenericType
-
forGenericTypeSignature
-
forGenericTypeVariables
-
forRawTypeName
-
forPrimitiveType
-
add
Creates a new type array with a fresh type appended to the end.- Parameters:
types
- the left hand side of the new arrayend
- the right hand side of the new array
-
insert
Creates a new type array with a fresh type inserted at the beginning.- Parameters:
start
- the left hand side of the new arraytypes
- the right hand side of the new array
-
forSignature
Constructs a Type for a JVM bytecode signature string. For example:UnresolvedType.forSignature("[Ljava/lang/Thread;") UnresolvedType.forSignature("I");
forName(String)
. This method should not be passed P signatures.UnresolvedType.forName("java.lang.Thread[]").equals(Type.forSignature("[Ljava/lang/Thread;") UnresolvedType.forName("int").equals(Type.forSignature("I"))
- Parameters:
signature
- the JVM bytecode signature string for the desired type.- Returns:
- a type object represnting that JVM bytecode signature.
-
forSignatures
Constructs a UnresolvedType for each JVM bytecode type signature in an incoming array.- Parameters:
sigs
- an array of JVM bytecode type signatures- Returns:
- an array of UnresolvedType objects.
- See Also:
forSignature(String)
-
getName
Returns the name of this type in java language form (e.g. java.lang.Thread or boolean[]). This produces a more aesthetically pleasing string thanClass.getName()
.- Returns:
- the java language name of this type.
-
getSimpleName
-
getRawName
-
getBaseName
-
getSimpleBaseName
-
getNames
Returns an array of strings representing the java langauge names of an array of types.- Parameters:
types
- an array of UnresolvedType objects- Returns:
- an array of Strings fo the java language names of types.
- See Also:
getName()
-
getSignature
Returns the name of this type in JVM signature form. For all UnresolvedType t:UnresolvedType.forSignature(t.getSignature()).equals(t)
UnresolvedType.forSignature(s).getSignature().equals(s)
- Returns:
- the java JVM signature string for this type.
-
getErasureSignature
For parameterized types, return the signature for the raw type -
needsModifiableDelegate
public boolean needsModifiableDelegate() -
setNeedsModifiableDelegate
public void setNeedsModifiableDelegate(boolean b) -
getRawType
-
getOutermostType
Returns a UnresolvedType object representing the effective outermost enclosing type for a name type. For all other types, this will return the type itself. The only guarantee is given in JLS 13.1 where code generated according to those rules will have type names that can be split apart in this way.- Returns:
- the outermost enclosing UnresolvedType object or this.
-
getComponentType
Returns a UnresolvedType object representing the component type of this array, or null if this type does not represent an array type.- Returns:
- the component UnresolvedType object, or null.
-
toString
Returns a java language string representation of this type. -
toDebugString
-
resolve
Returns a resolved version of this type according to a particular world.- Parameters:
world
- theWorld
within which to resolve.- Returns:
- a resolved type representing this type in the appropriate world.
-
write
Write out an UnresolvedType - the signature should be enough.- Throws:
IOException
-
read
Read in an UnresolvedType - just read the signature and rebuild the UnresolvedType.- Throws:
IOException
-
getNameAsIdentifier
-
getPackageNameAsIdentifier
-
getTypeParameters
-
getTypeVariables
-
getTypeVariableNamed
- Specified by:
getTypeVariableNamed
in interfaceTypeVariableDeclaringElement
-
toTraceString
- Specified by:
toTraceString
in interfaceTraceable
-
parameterize
Return a version of this parameterized type in which any type parameters that are type variable references are replaced by their matching type variable binding. -
getClassName
- Returns:
- the class name (does not include the package name)
-
getPackageName
- Returns:
- the package name (no class name included)
-
writeArray
public static void writeArray(UnresolvedType[] types, CompressingDataOutputStream stream) throws IOException- Throws:
IOException
-
readArray
- Throws:
IOException
-
makeArray
-