JML

org.multijava.mjc
Class CType

java.lang.Object
  extended byorg.multijava.util.Utils
      extended byorg.multijava.mjc.CType
All Implemented Interfaces:
Cloneable, Comparable, Constants, Constants, CTypeSignatureAppender
Direct Known Subclasses:
CBooleanType, CClassType, CNumericType, CValueType, CVoidType

public abstract class CType
extends Utils
implements Constants, Comparable, CTypeSignatureAppender

This class is the root for type hierarchy. It contains methods for generating type-signatures in bytecode, finding appropriate op-codes for operations on various types, and answering questions about the appropriateness of casts and assignments.


Nested Class Summary
static class CType.MethodSignature
          This data structure represents a method type signature as an array of specialized parameter types, a return type, and a receiver type (which may be null for regular Java method signatures).
static class CType.MethodSignatureParser
          This inner class provides methods for converting a bytecode type signature into an instance of (a subclass of) CType for use in compilation.
static class CType.StringBuffers
          This inner class optimizes performance by maintaining a stack of FastStringBuffers to be recycled.
static class CType.TupleCollection
          This nested class defines a collection of tuples where only the most general type tuples are retained in the collection.
 
Field Summary
static CType[] EMPTY
           
protected static CType.MethodSignatureParser instance
           
protected  boolean isMethodTypeVariable
           
protected  boolean isTypeVariable
           
protected  int type
           
 
Fields inherited from class org.multijava.util.Utils
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO
 
Fields inherited from interface org.multijava.mjc.Constants
ACC_MODIFIER_FLAGS_MASK, ACC_NON_NULL, ACC_NON_NULL_BY_DEFAULT, ACC_NULLABLE, ACC_NULLABLE_BY_DEFAULT, ACC_PURE, ACCESS_FLAG_ARRAY, ACCESS_FLAG_NAMES, AMID_JAVA_MATH, AMID_MAX, AMID_SAFE_MATH, CMP_VERSION, IMPLICITLY_NON_NULL, JAV_ASSERTION_ERROR, JAV_CLASS, JAV_CLASSLOADER, JAV_CLASSNOTFOUND_EXCEPTION, JAV_CLONE, JAV_CLONEABLE, JAV_CONSTRUCTOR, JAV_ERROR, JAV_EXCEPTION, JAV_INIT, JAV_LENGTH, JAV_NAME_SEPARATOR, JAV_NOCLASSDEFFOUND_ERROR, JAV_OBJECT, JAV_OUTER_THIS, JAV_RMJ_RUNTIME_EXCEPTION, JAV_RUNTIME, JAV_RUNTIME_EXCEPTION, JAV_SERIALIZABLE, JAV_STATIC_INIT, JAV_STRING, JAV_STRINGBUFFER, JAV_SUPER, JAV_THIS, JAV_THROWABLE, MJ_ANCHOR, NULLITY_MODS, OPE_BAND, OPE_BNOT, OPE_BOR, OPE_BSR, OPE_BXOR, OPE_EQ, OPE_GE, OPE_GT, OPE_LAND, OPE_LE, OPE_LNOT, OPE_LOR, OPE_LT, OPE_MINUS, OPE_NE, OPE_PERCENT, OPE_PLUS, OPE_POSTDEC, OPE_POSTINC, OPE_PREDEC, OPE_PREINC, OPE_SIMPLE, OPE_SL, OPE_SLASH, OPE_SR, OPE_STAR, TID_ARRAY, TID_BOOLEAN, TID_BYTE, TID_CHAR, TID_CLASS, TID_DOUBLE, TID_FLOAT, TID_INT, TID_LONG, TID_MAX, TID_SHORT, TID_VOID, UNIV_ARRAY_TMP, UNIV_TMP
 
Fields inherited from interface org.multijava.util.classfile.Constants
ACC_ABSTRACT, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VOLATILE, ATT_ANCHOR, ATT_BRIDGE, ATT_CODE, ATT_CONSTANTVALUE, ATT_DEPRECATED, ATT_DISPATCHER, ATT_EXCEPTIONS, ATT_GENERIC, ATT_GENERIC_FUNCTIONS, ATT_INNERCLASSES, ATT_LINENUMBERTABLE, ATT_LOCALVARIABLETABLE, ATT_MM_BODY, ATT_REDIRECTOR, ATT_RMJ_GLUE, ATT_RMJ_SIGNATURE, ATT_RUNTIME_VISIBLE_ANNOTATIONS, ATT_RUNTIME_VISIBLE_PARAMETER_ANNOTATIONS, ATT_SIGNATURE, ATT_SOURCEFILE, ATT_SYNTHETIC, ATT_UNIVERSE_FIELD, ATT_UNIVERSE_METHOD, ATT_UNIVERSE_VERSION, CST_CLASS, CST_DOUBLE, CST_FIELD, CST_FLOAT, CST_INTEGER, CST_INTERFACEMETHOD, CST_LONG, CST_METHOD, CST_NAMEANDTYPE, CST_STRING, CST_UTF8, ENV_DEBUG_MODE, ENV_USE_CACHE, JAVA_MAGIC, JAVA_MAJOR, JAVA_MINOR, MAX_CODE_PER_METHOD, opc_aaload, opc_aastore, opc_aconst_null, opc_aload, opc_aload_0, opc_aload_1, opc_aload_2, opc_aload_3, opc_anewarray, opc_areturn, opc_arraylength, opc_astore, opc_astore_0, opc_astore_1, opc_astore_2, opc_astore_3, opc_athrow, opc_baload, opc_bastore, opc_bipush, opc_caload, opc_castore, opc_checkcast, opc_d2f, opc_d2i, opc_d2l, opc_dadd, opc_daload, opc_dastore, opc_dcmpg, opc_dcmpl, opc_dconst_0, opc_dconst_1, opc_ddiv, opc_dload, opc_dload_0, opc_dload_1, opc_dload_2, opc_dload_3, opc_dmul, opc_dneg, opc_drem, opc_dreturn, opc_dstore, opc_dstore_0, opc_dstore_1, opc_dstore_2, opc_dstore_3, opc_dsub, opc_dup, opc_dup2, opc_dup2_x1, opc_dup2_x2, opc_dup_x1, opc_dup_x2, opc_f2d, opc_f2i, opc_f2l, opc_fadd, opc_faload, opc_fastore, opc_fcmpg, opc_fcmpl, opc_fconst_0, opc_fconst_1, opc_fconst_2, opc_fdiv, opc_fload, opc_fload_0, opc_fload_1, opc_fload_2, opc_fload_3, opc_fmul, opc_fneg, opc_frem, opc_freturn, opc_fstore, opc_fstore_0, opc_fstore_1, opc_fstore_2, opc_fstore_3, opc_fsub, opc_getfield, opc_getstatic, opc_goto, opc_goto_w, opc_i2b, opc_i2c, opc_i2d, opc_i2f, opc_i2l, opc_i2s, opc_iadd, opc_iaload, opc_iand, opc_iastore, opc_iconst_0, opc_iconst_1, opc_iconst_2, opc_iconst_3, opc_iconst_4, opc_iconst_5, opc_iconst_m1, opc_idiv, opc_if_acmpeq, opc_if_acmpne, opc_if_icmpeq, opc_if_icmpge, opc_if_icmpgt, opc_if_icmple, opc_if_icmplt, opc_if_icmpne, opc_ifeq, opc_ifge, opc_ifgt, opc_ifle, opc_iflt, opc_ifne, opc_ifnonnull, opc_ifnull, opc_iinc, opc_iload, opc_iload_0, opc_iload_1, opc_iload_2, opc_iload_3, opc_imul, opc_ineg, opc_instanceof, opc_invokeinterface, opc_invokespecial, opc_invokestatic, opc_invokevirtual, opc_ior, opc_irem, opc_ireturn, opc_ishl, opc_ishr, opc_istore, opc_istore_0, opc_istore_1, opc_istore_2, opc_istore_3, opc_isub, opc_iushr, opc_ixor, opc_jsr, opc_jsr_w, opc_l2d, opc_l2f, opc_l2i, opc_ladd, opc_laload, opc_land, opc_lastore, opc_lcmp, opc_lconst_0, opc_lconst_1, opc_ldc, opc_ldc2_w, opc_ldc_w, opc_ldiv, opc_lload, opc_lload_0, opc_lload_1, opc_lload_2, opc_lload_3, opc_lmul, opc_lneg, opc_lookupswitch, opc_lor, opc_lrem, opc_lreturn, opc_lshl, opc_lshr, opc_lstore, opc_lstore_0, opc_lstore_1, opc_lstore_2, opc_lstore_3, opc_lsub, opc_lushr, opc_lxor, opc_monitorenter, opc_monitorexit, opc_multianewarray, opc_new, opc_newarray, opc_nop, opc_pop, opc_pop2, opc_putfield, opc_putstatic, opc_ret, opc_return, opc_saload, opc_sastore, opc_sipush, opc_swap, opc_tableswitch, opc_wide, opc_xxxunusedxxx, POO_ASCII_CONSTANT, POO_CLASS_CONSTANT, POO_DOUBLE_CONSTANT, POO_FLOAT_CONSTANT, POO_INTEGER_CONSTANT, POO_LONG_CONSTANT, POO_NAT_CONSTANT, POO_REF_CONSTANT, POO_STRING_CONSTANT, TYP_ADDRESS, TYP_DOUBLE, TYP_FLOAT, TYP_INT, TYP_LONG, TYP_REFERENCE, TYP_VOID
 
Constructor Summary
protected CType(int type)
          Constructs a type signature
 
Method Summary
 void appendGenericSignature(FastStringBuffer buff)
           
 boolean changesByErasure()
          Returns whether this type differs from its type erasure (JLS3 4.6).
 boolean checked()
           
abstract  CType checkType(CContextType context)
          Checks that this type is valid, throwing an exception if it is not.
 int compareTo(Object o)
          Compares this to another type alphabetically by identifier.
 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)
           
static String genGenericMethodSignature(CTypeVariable[] tvs, CType returnType, CType receiverType, CSpecializedType[] parameters, boolean skipSynthParameter)
          Generates a multimethod signature as used in custom bytecode attributes.
static String genGenericMethodSignature(CTypeVariable[] tvs, CType returnType, CType[] parameters)
           
static String genGenericMethodSignatureHelper(CTypeVariable[] tvs, CType returnType, CType receiverType, CTypeSignatureAppender[] parameters, boolean skipSynthParameter)
           
static String genMethodSignature(CType returnType, CType[] parameters)
          Generates a method signature as used in regular Java bytecode.
private static String genMethodSignatureHelper(CType returnType, CType receiverType, CTypeSignatureAppender[] parameters, boolean skipSynthParameter)
          Helper method generates a method signature as used in regular Java bytecode if receiverType is null, or a multimethod signature otherwise.
static String genMultimethodSignature(CType returnType, CType receiverType, CSpecializedType[] parameters, boolean skipSynthParameter)
          Generates a multimethod signature as used in custom bytecode attributes.
 CClassType[][] getAllArguments()
           
 CClassType[] getArguments()
           
 CType getCapture(CContextType context)
          Returns the result of applying capture conversion (JLS3 5.1.10) to this type.
 CClass getCClass()
           
 CType getErasure()
           
 CType getErasure(CContextType context)
           
 String getGenericSignature()
           
 String getIdent()
           
 int getLoadOpcode()
          Returns the opcode to load a local variable of this type.
 int getReturnOpcode()
          Returns the opcode to return a value of this type.
 String getSignature()
          Transforms this type to a string
abstract  int getSize()
          Returns the size used in stack by value of this type
 int getStoreOpcode()
          Returns the opcode to store a local variable of this type.
 int getTypeID()
          Returns the ID of this type
 JExpression getValue()
           
 boolean implicitlyCastTo(CType dest)
          implicitlyCastTo
abstract  boolean isAlwaysAssignableTo(CType dest)
          Is this type assignable to the given type by assignment type conversion [JLS2 5.2].
 boolean isAlwaysAssignableTo(CType dest, boolean inst)
           
 boolean isAlwaysAssignableTo(CType dest, CClassType[] substitution)
           
 boolean isArrayType()
           
 boolean isAssignableTo(CType dest)
           
 boolean isBoolean()
          Check if a type is the boolean type
 boolean isCapture()
          Returns whether this is a wildcard capture type as resulting from capture conversion (JLS3 5.1.10).
abstract  boolean isCastableTo(CType dest)
          Can this type be converted to the specified type by casting conversion (JLS 5.5) ?
 boolean isCheckedException()
           
 boolean isClassType()
          Check if a type is a reference type (a class, interface, or array)
 boolean isClassTypeVariable()
          Returns whether this type is a type variable introduced by a generic class declaration (JLS3 8.1.2) or a generic interface declaration (JLS3 9.1.2) as opposed to a method type variable.
 boolean isCodedAsInt()
           
 boolean isConcrete()
          Indicates whether this type is concrete.
 boolean isFloatingPoint()
          Check if a type is a real number type
 boolean isGenericType()
          Indicates whether this type is a Generic class type
 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 isMethodTypeVariable()
           
 boolean isNestedType()
          Indicates whether this type is a nested type, i.e., a member type.
 boolean isNumeric()
          Check if a type is a numeric type
 boolean isOrdinal()
          Check if a type is an integer type
 boolean isPrimitive()
          Check if a type is a primitive scalar type
 boolean isRawType()
          Returns whether this is a raw type (JLS3 4.8).
 boolean isReference()
          Check if a type is a pointer type (which is the same as a class type)
 boolean isReifiableType()
          Returns whether this is a reifiable type (JLS3 4.7).
 boolean isTypeVariable()
          Check if a type is a type variable
 boolean isValueType()
           
 boolean isVoid()
          Check if a type is void type
 boolean isWildcard()
          Returns whether this is a wildcard type.
 boolean needsUncheckedConversion(CType dest)
          Returns whether unchecked conversion (JLS3 5.1.9) is required in order to convert from this type to the given type dest.
 boolean needsUncheckedConversion(CType dest, CClassType[] substitution)
          Returns whether unchecked conversion (JLS3 5.1.9) is required in order to convert from this type to the given type dest, eventually using the given generic substitution.
static CType parseGenericTypeSignature(String signature)
           
static CType parseGenericTypeSignature(String signature, CUniverseTypeAnnotation univAnnot)
           
static CType.MethodSignature parseMethodSignature(String sig)
          Returns a MethodSignature data structure by parsing the given method or multimethod signature as read from bytecode.
static CType.MethodSignature parseMethodSignature(String sig, CUniverseMethodAnnotation univAnnot)
           
static CType parseSignature(String signature)
          Parse a java type signature Description : Attempts to parse the provided string as if it started with the Java VM-standard signature for a type.
static CType parseSignature(String signature, CUniverseTypeAnnotation univAnnot)
           
 void plantDispatchTest(CodeSequence code, CodeLabel nextInstruction)
           
abstract  void resolveValueType(CExpressionContextType context)
          Compute the value of a specializer expression used to dispatch on a compile-time constant.
 void setMethodTypeVariable(boolean isMTV)
           
 void setTypeVariable(boolean isTV)
           
 String specializerSymbol()
          Returns the specializer symbol to use when this type is the specializer.
abstract  String toString()
          Transforms this type to a string
 String toVerboseString()
          A more verbose version of toString only used for error reporting.
static String tupleToString(CType recvType, CType[] actuals)
          Constructs a nicely format string representing the type tuple given by the arguments.
static String tupleToString(CType[] argTuple)
          Constructs a nicely formatted string representing the type tuple given by the argument array.
 
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
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.multijava.mjc.CTypeSignatureAppender
appendSignature
 

Field Detail

EMPTY

public static final CType[] EMPTY

type

protected int type

isTypeVariable

protected boolean isTypeVariable

isMethodTypeVariable

protected boolean isMethodTypeVariable

instance

protected static final CType.MethodSignatureParser instance
Constructor Detail

CType

protected CType(int type)
Constructs a type signature

Method Detail

equals

public boolean equals(Object other)
Compares two objects for equality.

Overrides:
equals in class Object
Parameters:
other - the object to compare with
Returns:
true iff other is a CType object representing the same Java type as this represents

equals

public boolean equals(Object other,
                      boolean enableUniv)
Compares two objects for equality.

Parameters:
other - the object to compare with
enableUniv - whether to also check the universe part this is needed sometimes to allow relaxed checks
Returns:
true iff other is a CType object representing the same Java type as this represents

equals

public boolean equals(CType other,
                      CClassType[] substitution)

equals

public boolean equals(CType other,
                      CClassType[] substitution,
                      boolean enableUniv)

compareTo

public int compareTo(Object o)
              throws ClassCastException
Compares this to another type alphabetically by identifier.

Specified by:
compareTo in interface Comparable
Throws:
ClassCastException

toString

public abstract String toString()
Transforms this type to a string

Overrides:
toString in class Object

toVerboseString

public String toVerboseString()
A more verbose version of toString only used for error reporting. Adds the universe modifier to the output. Made this a separate function, to make sure that we do not mess up any bytecode generation routines that use toString() By WMD.


isNestedType

public boolean isNestedType()
Indicates whether this type is a nested type, i.e., a member type.


getSignature

public String getSignature()
Transforms this type to a string

Returns:
the class file form of this type

getGenericSignature

public String getGenericSignature()

appendGenericSignature

public void appendGenericSignature(FastStringBuffer buff)
Specified by:
appendGenericSignature in interface CTypeSignatureAppender

getSize

public abstract int getSize()
Returns the size used in stack by value of this type


isNumeric

public boolean isNumeric()
Check if a type is a numeric type

Returns:
is it a numeric type ?

isVoid

public boolean isVoid()
Check if a type is void type

Returns:
is it void type ?

isCodedAsInt

public boolean isCodedAsInt()

isOrdinal

public boolean isOrdinal()
Check if a type is an integer type

Returns:
is it a integer type ?

isFloatingPoint

public boolean isFloatingPoint()
Check if a type is a real number type

Returns:
is it a real number type ?

isBoolean

public boolean isBoolean()
Check if a type is the boolean type

Returns:
is it the boolean type ?

isPrimitive

public boolean isPrimitive()
Check if a type is a primitive scalar type

Returns:
is it a numeric or boolean type ?

isReference

public boolean isReference()
Check if a type is a pointer type (which is the same as a class type)

Returns:
is it a subtype of ClassType ?

isClassType

public boolean isClassType()
Check if a type is a reference type (a class, interface, or array)

Returns:
is it a subtype of ClassType ?

isGenericType

public boolean isGenericType()
Indicates whether this type is a Generic class type


isRawType

public boolean isRawType()
Returns whether this is a raw type (JLS3 4.8).

Returns:
Whether this is a raw type.

isReifiableType

public boolean isReifiableType()
Returns whether this is a reifiable type (JLS3 4.7).

Returns:
Whether this is a reifiable type.

changesByErasure

public boolean changesByErasure()
Returns whether this type differs from its type erasure (JLS3 4.6).

Returns:
Whether this type differs from its type erasure.

getErasure

public CType getErasure(CContextType context)
                 throws UnpositionedError
Throws:
UnpositionedError

getErasure

public CType getErasure()

getCapture

public CType getCapture(CContextType context)
                 throws UnpositionedError
Returns the result of applying capture conversion (JLS3 5.1.10) to this type.

Note that capture conversion only changes a parametrized type with at least one wildcard in its type arguments.

Parameters:
context - The type checking context.
Returns:
The result of applying capture conversion to this type. Is never null.
Throws:
UnpositionedError - if some error occurs during type checking of the returned type.

getAllArguments

public CClassType[][] getAllArguments()

getArguments

public CClassType[] getArguments()

getIdent

public String getIdent()

getCClass

public CClass getCClass()
Returns:
the object class of this type

isTypeVariable

public boolean isTypeVariable()
Check if a type is a type variable


isClassTypeVariable

public boolean isClassTypeVariable()
Returns whether this type is a type variable introduced by a generic class declaration (JLS3 8.1.2) or a generic interface declaration (JLS3 9.1.2) as opposed to a method type variable.

Returns:
Whether this type is a class type variable.

isMethodTypeVariable

public boolean isMethodTypeVariable()

setMethodTypeVariable

public void setMethodTypeVariable(boolean isMTV)

setTypeVariable

public void setTypeVariable(boolean isTV)

isWildcard

public boolean isWildcard()
Returns whether this is a wildcard type.

Returns:
Whether this is a wildcard type.

isCapture

public boolean isCapture()
Returns whether this is a wildcard capture type as resulting from capture conversion (JLS3 5.1.10).

Returns:
Whether this is a wildcard capture type.

isInterface

public boolean isInterface()
Check if a type is an interface

Returns:
is it a class type representing an interface ?

isArrayType

public boolean isArrayType()
Returns:
is this type an array ?

isValueType

public boolean isValueType()
Returns:
is this type representing a value specializer ?

checked

public boolean checked()
Returns:
true if this type is valid

getTypeID

public int getTypeID()
Returns the ID of this type


isConcrete

public boolean isConcrete()
Indicates whether this type is concrete. All types are concrete except abstract class types and interface types.

Returns:
whether this type is concrete

 assignable objectState;
 

isLocalTo

public boolean isLocalTo(CContextType context)
Indicates whether this type is declared local to the given context. Can only be true of reference types.

Parameters:
context - the context in which to check
Returns:
whether this type is declared local to the given context

 assignable objectState;
 

specializerSymbol

public String specializerSymbol()
Returns the specializer symbol to use when this type is the specializer.


checkType

public abstract CType checkType(CContextType context)
                         throws UnpositionedError
Checks that this type is valid, throwing an exception if it is not. For class types this check resolves type names into their fully qualified versions and sets the class parameter so that getCClass returns the appropriate singleton.

Throws:
UnpositionedError - this unpositioned error should be positioned by the calling node of the AST, typically by calling the addPosition method of UnpositionedError

resolveValueType

public abstract void resolveValueType(CExpressionContextType context)
                               throws PositionedError
Compute the value of a specializer expression used to dispatch on a compile-time constant.

Parameters:
context - the context in which this class declaration appears
Throws:
PositionedError

isCastableTo

public abstract boolean isCastableTo(CType dest)
Can this type be converted to the specified type by casting conversion (JLS 5.5) ?

Parameters:
dest - the destination type
Returns:
true iff the casting conversion is valid

 assignable objectState;
 

implicitlyCastTo

public boolean implicitlyCastTo(CType dest)
implicitlyCastTo

Parameters:
dest - the expression type to cast to
Returns:
cast is valid ?

isAlwaysAssignableTo

public abstract boolean isAlwaysAssignableTo(CType dest)
Is this type assignable to the given type by assignment type conversion [JLS2 5.2].

Parameters:
dest - the destination type
Returns:
true iff assignment is valid

 //assignable objectState;
 

isAlwaysAssignableTo

public boolean isAlwaysAssignableTo(CType dest,
                                    boolean inst)

isAlwaysAssignableTo

public boolean isAlwaysAssignableTo(CType dest,
                                    CClassType[] substitution)

isAssignableTo

public boolean isAssignableTo(CType dest)

needsUncheckedConversion

public boolean needsUncheckedConversion(CType dest)
Returns whether unchecked conversion (JLS3 5.1.9) is required in order to convert from this type to the given type dest.

Parameters:
dest - The target type.
Returns:
Whether unchecked conversion is required to convert this type to the type dest.
See Also:
isAlwaysAssignableTo(CType)

needsUncheckedConversion

public boolean needsUncheckedConversion(CType dest,
                                        CClassType[] substitution)
Returns whether unchecked conversion (JLS3 5.1.9) is required in order to convert from this type to the given type dest, eventually using the given generic substitution.

Parameters:
dest - The target type.
substitution - The generic substitution for class type variables.
Returns:
Whether unchecked conversion is required to convert this type to the type dest.
See Also:
isAlwaysAssignableTo(CType)

isCheckedException

public boolean isCheckedException()
Returns:
true if this type corrsponds to a checked exception

getValue

public JExpression getValue()
Returns:
the value expression of this type (for value types only)

getLoadOpcode

public int getLoadOpcode()
Returns the opcode to load a local variable of this type.


getStoreOpcode

public int getStoreOpcode()
Returns the opcode to store a local variable of this type.


getReturnOpcode

public int getReturnOpcode()
Returns the opcode to return a value of this type.


plantDispatchTest

public void plantDispatchTest(CodeSequence code,
                              CodeLabel nextInstruction)

parseSignature

public static CType parseSignature(String signature)
Parse a java type signature Description : Attempts to parse the provided string as if it started with the Java VM-standard signature for a type.


parseSignature

public static CType parseSignature(String signature,
                                   CUniverseTypeAnnotation univAnnot)

parseGenericTypeSignature

public static CType parseGenericTypeSignature(String signature)

parseGenericTypeSignature

public static CType parseGenericTypeSignature(String signature,
                                              CUniverseTypeAnnotation univAnnot)

parseMethodSignature

public static CType.MethodSignature parseMethodSignature(String sig)
Returns a MethodSignature data structure by parsing the given method or multimethod signature as read from bytecode.


parseMethodSignature

public static CType.MethodSignature parseMethodSignature(String sig,
                                                         CUniverseMethodAnnotation univAnnot)

genMethodSignature

public static String genMethodSignature(CType returnType,
                                        CType[] parameters)
Generates a method signature as used in regular Java bytecode.


genGenericMethodSignature

public static String genGenericMethodSignature(CTypeVariable[] tvs,
                                               CType returnType,
                                               CType[] parameters)

genMultimethodSignature

public static String genMultimethodSignature(CType returnType,
                                             CType receiverType,
                                             CSpecializedType[] parameters,
                                             boolean skipSynthParameter)
Generates a multimethod signature as used in custom bytecode attributes.


genGenericMethodSignature

public static String genGenericMethodSignature(CTypeVariable[] tvs,
                                               CType returnType,
                                               CType receiverType,
                                               CSpecializedType[] parameters,
                                               boolean skipSynthParameter)
Generates a multimethod signature as used in custom bytecode attributes.


genGenericMethodSignatureHelper

public static String genGenericMethodSignatureHelper(CTypeVariable[] tvs,
                                                     CType returnType,
                                                     CType receiverType,
                                                     CTypeSignatureAppender[] parameters,
                                                     boolean skipSynthParameter)

genMethodSignatureHelper

private static String genMethodSignatureHelper(CType returnType,
                                               CType receiverType,
                                               CTypeSignatureAppender[] parameters,
                                               boolean skipSynthParameter)
Helper method generates a method signature as used in regular Java bytecode if receiverType is null, or a multimethod signature otherwise.


tupleToString

public static String tupleToString(CType[] argTuple)
Constructs a nicely formatted string representing the type tuple given by the argument array.

Parameters:
argTuple - length > 0
Returns:
a nicely format string

tupleToString

public static String tupleToString(CType recvType,
                                   CType[] actuals)
Constructs a nicely format string representing the type tuple given by the arguments.

Parameters:
recvType - the type of the first element in the tuple
actuals - length >= 0
Returns:
a nicely format string

JML

JML is Copyright (C) 1998-2002 by Iowa State University and is distributed under the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This release depends on code from the MultiJava project and is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.