|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.multijava.util.Utils
org.multijava.mjc.CType
org.multijava.mjc.CClassType
This class represents a class type in the type structure.
CType| Nested Class Summary |
| Nested classes inherited from class org.multijava.mjc.CType |
CType.MethodSignature, CType.MethodSignatureParser, CType.StringBuffers, CType.TupleCollection |
| Field Summary | |
protected CClassType[][] |
arguments
|
private static CClass |
BAC_CLASS
|
private String |
cachedString
|
private CClass |
clazz
|
static CClassType[] |
EMPTY
|
static CClassType[][] |
EMPTY_ARG
|
protected int |
index
|
protected CUniverse |
universe
Stores the universe modifier that is attached with this class type. |
| Fields inherited from class org.multijava.mjc.CType |
instance, isMethodTypeVariable, isTypeVariable, type |
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
protected |
CClassType()
Construct a class type |
|
CClassType(CClass clazz)
Construct a class type with the default universe. |
|
CClassType(CClass clazz,
CUniverse univ)
Construct a class type with a universe. |
| Method Summary | |
void |
appendSignature(FastStringBuffer buff)
Transforms this type to a string |
CType |
checkType(CContextType context)
Checks that this type is valid, throwing an exception if it is not. |
Object |
clone()
We need to allow cloning of CClassType and its subtypes, in order to be able to create a new CClassType with the correct universe modifier. |
CClassType |
createSubstitutedType(CClass local,
CClassType prefixType,
CClassType[][] substitution)
|
Collection |
directlyVisibleTypes()
Returns the set of types (excluding non-reference types) that are directly visible from this type. |
boolean |
equals(Object other)
Compares two objects for equality. |
boolean |
equals(Object other,
boolean enableUniv)
Compares two objects for equality. |
boolean |
equals(CType other,
CClassType[] substitution)
|
boolean |
equals(CType other,
CClassType[] substitution,
boolean enableUniv)
|
CClassType[][] |
getAllArguments()
return the arguments of this type |
CClassType[] |
getArguments()
|
private CClass |
getCachedCClass()
Get source class from cached info of all loaded classes in CTopLevel. |
CClass |
getCClass()
Returns the class object associated with this type. |
CUniverse |
getCUniverse()
Return the universe of this class type. |
String |
getCUniverseJMLString()
Return the universe modifier as string, for output in JML specifications. |
String |
getCUniverseString()
Return the universe modifier as string. |
CType |
getErasure(CContextType context)
|
int |
getIndex()
|
int |
getSize()
Returns the size used in stack by value of this type |
byte |
getUniverseByteConstant()
Return the universe byte constant for this class type. |
static Collection |
getVisibleTypesFrom(Collection dirVisTypes)
Returns the set of visible types by finding the reflexive, transitive closure of directlyVisibleTypes() on each type in the given collection. |
int |
hashCode()
Calculates the hash code for this |
String |
ident()
|
boolean |
implicitlyCastTo(CType dest)
implicitlyCastTo |
boolean |
isAlwaysAssignableTo(CType dest)
|
boolean |
isAlwaysAssignableTo(CType dest,
boolean inst)
Is this type assignable to the given type by assignment type conversion [JLS2 5.2] [JLS2 5.1.4] |
boolean |
isAlwaysAssignableTo(CType dest,
CClassType[] substitution)
|
boolean |
isAlwaysAssignableTo(CType dest,
CClassType[] substitution,
boolean inst)
|
boolean |
isAlwaysAssignableToNoUniverses(CType dest,
CClassType[] substitution)
A version of the Assignable check without considering the Universe types. |
boolean |
isAssignableTo(CType dest)
|
boolean |
isCastableTo(CType dest)
Can this type be converted to the specified type by casting conversion (JLS 5.5) ? |
protected boolean |
isChecked()
Returns true if this class type has been resolved to a CClass singleton. |
boolean |
isCheckedException()
Returns true if this represents the type of a checked exception. |
boolean |
isClassType()
Check if a type is a class type |
boolean |
isConcrete()
Indicates whether this type is concrete. |
boolean |
isInterface()
Check if a type is an interface |
boolean |
isLocalTo(CContextType context)
Indicates whether this type is declared local to the given context. |
boolean |
isNestedType()
Indicates whether this type is a nested type, i.e., a member type. |
boolean |
isReference()
Check if a type is a reference |
String |
originalQualifiedName()
|
void |
plantDispatchTest(CodeSequence code,
CodeLabel nextInstruction)
|
String |
printArgs()
|
String |
qualifiedName()
|
void |
resolveValueType(CExpressionContextType context)
Compute the value of a specializer expression used to dispatch on a compile-time constant. |
void |
setAllArguments(CClassType[][] arguments)
|
protected void |
setClass(CClass clazz)
Sets the CClass singleton that goes with this class type. |
void |
setCUniverse(CUniverse univ)
Set the universe of this class type. |
void |
setIndex(int i)
set the type variable to the given index |
String |
toString()
Transforms this type to a string |
String |
toVerboseString()
Return the universe modifier plus the class type as string. |
| Methods inherited from class org.multijava.util.Utils |
assertTrue, assertTrue, combineArrays, escapeString, escapeString, fail, fail, getFilePath, hasFlag, hasOtherFlags, parsePathParts, relativePathTo, splitQualifiedName, splitQualifiedName, stripJavaModifiers, stripNonJavaModifiers, stripPrivateModifier, unescapeString, vectorToArray, vectorToIntArray |
| Methods inherited from class java.lang.Object |
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final CClassType[] EMPTY
public static final CClassType[][] EMPTY_ARG
private static final CClass BAC_CLASS
private CClass clazz
protected int index
protected CClassType[][] arguments
protected CUniverse universe
private String cachedString
| Constructor Detail |
protected CClassType()
public CClassType(CClass clazz)
public CClassType(CClass clazz,
CUniverse univ)
clazz - the class that will represent this type| Method Detail |
protected boolean isChecked()
public int getIndex()
public void setIndex(int i)
protected void setClass(CClass clazz)
clazz - the CClass singleton that goes with this class typepublic void setCUniverse(CUniverse univ)
univ - The new universe modifier.
If the parameter is null, then the peer modifier is used.
public Object clone()
throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionpublic boolean equals(Object other)
equals in class CTypeother - the object to compare with
other is a CType object
representing the same Java type as this represents
WMD: Forward the call to the universe enabled version below.
public boolean equals(Object other,
boolean enableUniv)
equals in class CTypeother - the object to compare withenableUniv - whether to also check the universe part
this is needed sometimes to allow relaxed checks
other is a CType object
representing the same Java type as this represents
public boolean equals(CType other,
CClassType[] substitution)
equals in class CType
public boolean equals(CType other,
CClassType[] substitution,
boolean enableUniv)
equals in class CTypepublic int hashCode()
hashCode in class Objectalso assignable loadedClassInfo, thisClassInfo;
public String toString()
also assignable loadedClassInfo, thisClassInfo; ensures \not_modified(loadedClassInfo);
toString in class CTypepublic String printArgs()
public String originalQualifiedName()
public String toVerboseString()
toVerboseString in class CTypepublic String getCUniverseString()
public String getCUniverseJMLString()
public boolean isNestedType()
isNestedType in class CTypepublic void appendSignature(FastStringBuffer buff)
appendSignature in interface CTypeSignatureAppenderpublic String ident()
assignable loadedClassInfo, thisClassInfo;
public String qualifiedName()
assignable loadedClassInfo, thisClassInfo;
public int getSize()
public boolean isReference()
isReference in class CTypepublic boolean isClassType()
isClassType in class CTypepublic boolean isInterface()
isInterface in class CTypealso assignable loadedClassInfo, thisClassInfo;
public boolean isConcrete()
isConcrete in class CTypealso assignable loadedClassInfo, thisClassInfo;
public boolean isLocalTo(CContextType context)
isLocalTo in class CTypecontext - the context in which to check
also assignable loadedClassInfo, thisClassInfo;
public CClass getCClass()
getCClass in class CTypepublic CUniverse getCUniverse()
public byte getUniverseByteConstant()
public CClassType createSubstitutedType(CClass local,
CClassType prefixType,
CClassType[][] substitution)
public CType checkType(CContextType context)
throws UnpositionedError
context - the context in which this type was
declared, may be null
UnpositionedError - this unpositioned error
should be positioned
by the calling node of
the AST, typically by
calling the
addPosition method of
UnpositionedError
also assignable loadedClassInfo, thisClassInfo;
public void resolveValueType(CExpressionContextType context)
throws PositionedError
context - the context in which this class
declaration appears
PositionedError - if the check fails
public boolean isAlwaysAssignableTo(CType dest,
boolean inst)
isAlwaysAssignableTo in class CTypedest - the destination type
WMD: In addition the universes have to be assignable, too.also assignable_redundantly thisClassInfo;
public boolean isAlwaysAssignableTo(CType dest,
CClassType[] substitution)
isAlwaysAssignableTo in class CType
public boolean isAlwaysAssignableToNoUniverses(CType dest,
CClassType[] substitution)
public boolean isAlwaysAssignableTo(CType dest)
CType
public boolean isAlwaysAssignableTo(CType dest,
CClassType[] substitution,
boolean inst)
public boolean isAssignableTo(CType dest)
isAssignableTo in class CType
public CType getErasure(CContextType context)
throws UnpositionedError
getErasure in class CTypeUnpositionedErrorpublic boolean isCastableTo(CType dest)
dest - the destination type
WMD: added additional conditions for the universe modifiersalso assignable loadedClassInfo, thisClassInfo;
public boolean implicitlyCastTo(CType dest)
implicitlyCastTo in class CTypedest - the expression type to cast to
public boolean isCheckedException()
isCheckedException in class CTypepublic Collection directlyVisibleTypes()
assignable loadedClassInfo, thisClassInfo;
public static Collection getVisibleTypesFrom(Collection dirVisTypes)
dirVisTypes - an initial collection of directly visible types
requires (\forall Object o; dirVisTypes.contains(o); o instanceof CType);
public void plantDispatchTest(CodeSequence code,
CodeLabel nextInstruction)
plantDispatchTest in class CTypeprivate CClass getCachedCClass()
assignable loadedClassInfo, thisClassInfo;
public CClassType[] getArguments()
getArguments in class CTypepublic CClassType[][] getAllArguments()
getAllArguments in class CTypepublic void setAllArguments(CClassType[][] arguments)
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||