|
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
org.multijava.mjc.CWildcardType
Type representing a wildcard (JLS3 4.5.1). The semantics of a wildcard in the generic Java type system are fully determined by its optional upper/lower bound and by the formal type variable (JLS3 4.4) for which the wildcard is a type argument (JLS3 4.5.1).
| Nested Class Summary |
| Nested classes inherited from class org.multijava.mjc.CType |
CType.MethodSignature, CType.MethodSignatureParser, CType.StringBuffers, CType.TupleCollection |
| Field Summary | |
private CClassType |
bound
The (upper or lower) bound of the wildcard. |
private boolean |
isUpperBounded
Indicates whether the wildcard has been explicitely or implicitely upper bounded. |
private CTypeVariable |
typeVariable
The formal type variable for which this wildcard is a type argument. |
| Fields inherited from class org.multijava.mjc.CClassType |
arguments, EMPTY, EMPTY_ARG, index, universe |
| 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 | |
private |
CWildcardType(boolean isUpperBounded,
CClassType bound)
Constructor for creating an eventually bounded wildcard. |
| Method Summary | |
void |
appendGenericSignature(FastStringBuffer buffer)
|
void |
appendSignature(FastStringBuffer buff)
Note that a non-generic signature should never be used for a wildcard since a wildcard is always a generic type argument. |
CClassType |
capture()
The capture type depends on the optional bound of the wildcard as well as on the formal type variable for which this wildcard is a type argument. |
CType |
checkType(CContextType context)
During type checking, the wildcard's optional bound is type checked, too. |
boolean |
contains(CClassType type)
Returns whether this type contains the given type as defined in JLS3 4.5.1.1. |
static CWildcardType |
createLowerBoundedWildcard(CClassType lowerBound)
Creates a lower bounded wildcard with the given lowerBound. |
static CWildcardType |
createUpperBoundedWildcard(CClassType upperBound)
Creates an upper bounded wildcard with the given upperBound. |
static CWildcardType |
createWildcard()
Creates a wildcard implicitely upper bounded by the java.lang.Object class. |
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 |
getBound()
Returns the (upper or lower) bound of this wildcard which is null if and only if the wildcard was declared without an
explicit bound. |
CType |
getErasure()
Returns the erasure of this wildcard's capture type. |
CClassType |
getExplicitOrImplicitBound()
Convenience method returning either the bound explicitely provided in the wildcard declaration, if any, or, otherwise, the implicit bound java.lang.Object. |
CTypeVariable |
getTypeVariable()
Returns the formal type variable for which this wildcard is a type argument. |
boolean |
isAlwaysAssignableTo(CType dest)
This wildcard is assignable to the given type if and only
if its capture type is assignable to it. |
boolean |
isAlwaysAssignableTo(CType dest,
boolean inst)
This wildcard is assignable to the given type if and only
if its capture type is assignable to it. |
boolean |
isAlwaysAssignableTo(CType dest,
CClassType[] substitution)
This wildcard is assignable to the given type if and only
if its capture type is assignable to it. |
boolean |
isAlwaysAssignableToNoUniverses(CType dest,
CClassType[] substitution)
This wildcard is assignable to the given type if and only
if its capture type is assignable to it. |
boolean |
isBounded()
Returns whether an explicit bound has been specified in the declaration of this wildcard. |
boolean |
isUpperBounded()
Returns whether this wildcard type has an explicit or implicit upper bound. |
boolean |
isValidTypeArgumentFor(CTypeVariable typeVariable,
CClassType[] substitution)
Returns whether this type is a valid type argument for the given typeVariable. |
boolean |
isWildcard()
Returns whether this is a wildcard type. |
void |
setTypeVariable(CTypeVariable typeVariable)
Sets the formal type variable for which this wildcard is a type argument. |
String |
toString()
Transforms this type to a 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 |
private boolean isUpperBounded
private CClassType bound
null
if and only if the wildcard was declared without an explicit bound.
private CTypeVariable typeVariable
| Constructor Detail |
private CWildcardType(boolean isUpperBounded,
CClassType bound)
private. That way, client code must use
the provided static factory methods which indirectly invoke
this constructor with the correct parameters.
isUpperBounded - Whether the wildcard is upper bounded (explicitly
or implicitly) or not (i.e. lower bounded).bound - The upper/lower bound (according to the flag
isUpperBounded) of the wildcard or
null if the wildcard is not bounded.createWildcard(),
createUpperBoundedWildcard(CClassType),
createLowerBoundedWildcard(CClassType)| Method Detail |
public static CWildcardType createWildcard()
java.lang.Object class.
public static CWildcardType createUpperBoundedWildcard(CClassType upperBound)
upperBound.
upperBound - The upper bound of the wildcard to create.
upperBound.public static CWildcardType createLowerBoundedWildcard(CClassType lowerBound)
lowerBound.
lowerBound - The lower bound of the wildcard to create.
lowerBound.public boolean isWildcard()
CType
isWildcard in class CTypepublic boolean isBounded()
createWildcard(),
createUpperBoundedWildcard(CClassType),
createLowerBoundedWildcard(CClassType)public boolean isUpperBounded()
public CClassType getBound()
null if and only if the wildcard was declared without an
explicit bound.
public CClassType getExplicitOrImplicitBound()
java.lang.Object.
null.getBound(),
isBounded()public boolean contains(CClassType type)
CClassType
contains in class CClassTypepublic boolean isAlwaysAssignableTo(CType dest)
type if and only
if its capture type is assignable to it.
isAlwaysAssignableTo in class CClassTypecapture()
public boolean isAlwaysAssignableTo(CType dest,
boolean inst)
type if and only
if its capture type is assignable to it.
isAlwaysAssignableTo in class CClassTypecapture()
public boolean isAlwaysAssignableTo(CType dest,
CClassType[] substitution)
type if and only
if its capture type is assignable to it.
isAlwaysAssignableTo in class CClassTypecapture()
public boolean isAlwaysAssignableToNoUniverses(CType dest,
CClassType[] substitution)
type if and only
if its capture type is assignable to it.
isAlwaysAssignableToNoUniverses in class CClassTypecapture()
public boolean isValidTypeArgumentFor(CTypeVariable typeVariable,
CClassType[] substitution)
CClassTypetypeVariable.
isValidTypeArgumentFor in class CClassTypepublic boolean equals(Object other)
CClassType
equals in class CClassType
public boolean equals(Object other,
boolean enableUniv)
CClassType
equals in class CClassType
public boolean equals(CType other,
CClassType[] substitution)
equals in class CClassType
public boolean equals(CType other,
CClassType[] substitution,
boolean enableUniv)
equals in class CClassTypepublic CTypeVariable getTypeVariable()
public void setTypeVariable(CTypeVariable typeVariable)
typeVariable - The type variable for which this wildcard is a type
argument.
public CType checkType(CContextType context)
throws UnpositionedError
setTypeVariable(CTypeVariable) before invoking this
method. Furthermore, this type variable must already have been type
checked to be able to query its CClass.
checkType in class CClassTypeUnpositionedErrorpublic CClassType capture()
setTypeVariable(CTypeVariable) before invoking
this method.
capture in class CClassTypenull.CCaptureType,
getTypeVariable(),
setTypeVariable(CTypeVariable)public void appendSignature(FastStringBuffer buff)
appendSignature in interface CTypeSignatureAppenderappendSignature in class CClassTypeappendGenericSignature(FastStringBuffer)public void appendGenericSignature(FastStringBuffer buffer)
appendGenericSignature in interface CTypeSignatureAppenderappendGenericSignature in class CTypepublic CType getErasure()
getErasure in class CClassTypecapture()public String toString()
CClassTypealso assignable loadedClassInfo, thisClassInfo; ensures \not_modified(loadedClassInfo);
toString in class CClassType
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||