mjc

org.multijava.mjc
Class CClass

java.lang.Object
  extended byorg.multijava.util.Utils
      extended byorg.multijava.mjc.CMember
          extended byorg.multijava.mjc.CClass
All Implemented Interfaces:
Cloneable, CMemberHost, Comparable, Constants, Constants
Direct Known Subclasses:
CBadClass, CBinaryClass, CSourceClass

public abstract class CClass
extends CMember
implements CMemberHost, Comparable

This class represents a class declaration in the signature hierarchy.

See Also:
CMember

Nested Class Summary
protected  class CClass.NoDupStrategy
          This class is a specialization of CMethodSet.Strategy that keeps track of which CClass instances have already been searched for appropriate methods.
static interface CClass.Observer
           
 
Field Summary
private static int accessID
           
private  CMethod assertHelperMethod
          The synthetic methods used to implement assertions
private  CAssertStaticInitMethod assertStaticInitMethod
           
private  CAugmentationMap augMap
          Contains a mapping from contexts to the the set of augmenting methods for this class in each context.
static CClass CLS_UNDEFINED
           
private  Main compiler
           
protected  CClassType[] dispClassTypes
          Stores the dispatcher classes contained within the class or generic function anchor represented by this.
private  CMethodSet fieldGetterMethods
          The field getter methods of this class
private  CFieldTable fields
          Maps names to field signature for all the fields of this class.
private  CMethodSet fieldSetterMethods
          The field setter methods of this class
private  CClassType[] innerClasses
           
private  CClassType[] interfaces
           
protected  CMethodSet methods
          The methods of this class after dispatcher wrapping.
private static TokenReference NO_TOKEN
          Used for error reporting.
private  HashSet observerSet
          Stores the observers that are to be notified when #setCheckedMembers() is called.
private  CMethodSet protoMethods
          The methods of this class as generated from the declarations after the checkInterface pass but before dispatcher wrapping.
private  String qualifiedName
           
private  CMethodSet redirectorMethods
          Redirectors for inherited external methods that implement a regular Java interface.
private  File sourceFile
           
private  CClassType superClass
           
private  int syntheticIndex
           
private  boolean syntheticOuterThisInaccessible
          Flag is true if we are not generating a synthetic outer 'this' field for this inner class, because the outer this is not accessible.
private  CClassType type
           
private  CTypeVariable[] typevariables
           
private  HashSet visibleNestedTypes
          Tracks the nested and inner classes referred to within this class (whether or not their declarations are lexically enclosed in this class).
private  CMethodSet wrapperMethods
          The wrapper methods of this class
 
Fields inherited from class org.multijava.mjc.CMember
 
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
CClass(Main compiler, MemberAccess access, File sourceFile, String ident, String qualifiedName, CClassType superClass, boolean deprecated)
          Constructs a class signature.
 
Method Summary
protected  void accumLocalExtAndInheritedMethods(String name, CClass.NoDupStrategy actor, CMethodSet accum, CClassType[] args, CContextType context)
          Accumulates the set of methods with identifier name declared in the type represented by this, or added to the type by external methods, using the strategy actor.
protected  void accumLocalInternalMethods(String name, CClass.NoDupStrategy actor, CMethodSet accum, CClassType[] args)
          Accumulates the set of methods with identifier name declared in the type represented by this, using the strategy actor.
protected  void accumMostSpecificMethods(String name, CClass.NoDupStrategy actor, CMethodSet accum, CClassType[] args, CContextType context)
          Accumulates the set of methods with identifier name declared in the type represented by this, or added to the type by external methods, using the strategy actor.
 void addBridgeMethod(CMethod me, CContextType context)
           
 void addField(CSourceField field)
          Add inner fields
 void addRedirector(CSourceRedirectorMethod redir)
          Adds a synthetic redirector method to this.
protected  void appendCustomAttributes(AttributeList accum)
          Appends any custom attributes for this class to the attribute list represented by accum.
 void augmentWithMethod(CMethod m, CCompilationUnitContextType c)
           
 void checkBridgeMethod(CMethod me, CClassType[] args, CContextType context)
           
 void checkTypeVariables(CContextType context)
          Performs the typechecking for the type variables of this class.
 void close(CMethod[] methods_A, CClassType[] dispClassTypes)
          Ends the definition of this class by adding the dispatcher-wrapped methods and inner-dispatcher classes.
 void collectAbstractMethods(ArrayList v, CClassType[] args)
          Walks up the extends hierarchy and adds all abstract methods to the given list.
 void collectInterfaceMethods(ArrayList v, CClassType[] args)
          Walks up the implements and extends hierarchies and adds all methods of interfaces to the given list.
 int compareTo(Object o)
          Compares this to a given object.
protected  ClassInfo createClassInfo(long modifiers, String superClass, File sourceFile)
          Creates an instance of ClassInfo.
 boolean descendsFrom(CClass maybeSuper)
          Indicates whether this host is a subclass of the given class, where "subclass" is the reflexive, transitive closure of the extends relation.
 boolean descendsFrom(CClassType maybeSuper, CClassType maybeSub)
           Returns whether the given maybeSuper type is a supertype of the maybeSub type.
 Collection directlyVisibleTypes()
          Returns the set of types (excluding non-reference types) that are directly visible from this class.
 boolean equals(Object o)
          Compares the fully qualified name of this with the fully qualified name of o.
 Collection fields()
          Returns a Collection of CField values, one for each field in this class.
protected  CFieldTable fieldsForCodeGen()
          Returns the data structure representing the fields that will be used for generating bytecode.
private  CFieldAccessorMethod findAccessorMethod(CField f, CMethodSet ms)
           
 CFieldAccessorMethod findGetterMethod(CField f)
           
 CFieldAccessorMethod findOrCreateGetterMethod(CField f)
           
 CFieldAccessorMethod findOrCreateSetterMethod(CField f)
           
 void genClassFile(Destination dest)
          Generate the code in a class file.
 CType[] genConstructorArray(CType[] params)
          Mutates the given array to add any synthetic parameters for outer local variables referenced within the class represented by this.
protected  AttributeList genCustomAttributes()
          Returns an attribute list containing all the custom attributes to be added to the top-level classinfo generated for this.
protected  FieldInfo[] genFields()
          Returns an array representing all the fields for bytecode.
protected  void genGenericFunctions(ArrayList accum)
          Accumulates an array of all the required gf_info data structures for this.
 InnerClassInfo genInnerInfo()
          Generates the inner class info record for this.
protected  InnerClassInfo[] genInners()
          Returns an array representing (for bytecode) the type signatures of the inner and nested classes.
protected  ClassConstant[] genInterfaces()
          Returns an array representing (for bytecode) the qualified names of the implemented interfaces.
protected  MethodInfo[] genMethods()
          Returns an array representing all the methods for bytecode.
 void genSyntheticParams(CodeSequence code)
          Adds synthetic parameters to the code sequence for a call to this class's constructor.
 void genSyntheticParamsForExplicitThis(CodeSequence code, CMethod constructor)
          Adds synthetic parameters to the code sequence for an explicit constructor invocation to this class's constructor.
 CMethodSet.MethodArgsPair[] getAbstractMethods()
          Returns a list of abstract methods
 void getAllInheritableMethods(ArrayList v)
          Walks up the extends and implements hierarchies and adds all inheritable methods to the given list, v, if methods of the same signature are not already contained in v.
 ArrayList getAllInheritedMethods()
          Return all methods that are inherited from supertypes, except for those overridden in this class.
 void getAllMethods(ArrayList v)
          Walks up the extends hierarchy and adds all methods to the given list.
 CClass getCClass()
           
 Main getCompiler()
          Returns the compiler
protected  CField getDeclaredField(String ident)
          Returns the signature of the field with the given name declared in this class, or null if this class does not declare a field with the given name.
 int getFieldCount()
          Returns the number of fields in this class.
 String getGenericSignature()
           
protected static String getIdentFrom(String qualifiedName)
           
 CClassType[] getInnerClasses()
          Returns an array of the types of the inner classes of the class represented by this.
 CMethodSet.MethodArgsPair[] getInterfaceMethods()
          Returns a list of interface methods
 CClassType[] getInterfaces()
           
static String getNextAccessName()
           
 int getNextSyntheticIndex()
          Returns a unique int for use in naming synthetic classes (e.g. anonymous classes).
 CClassType getSubstitution(CTypeVariable typevariable, CClassType[] sub)
           
 CClassType getSubstitution(CTypeVariable typevariable, CClassType[][] sub)
          When a generic type is instantiated, the type variables should be substituted with the type arguments, This method returns the corresponding type arguments for the type variable
 CClass getSuperClass()
          Returns the super class of this class
 CClassType getSuperSubstitution(CClassType supertype, CTypeVariable typeVar)
           
 CClassType getSuperType()
          Returns the supertype of this class or null if this is the java.lang.Object class.
 JExpression[] getSyntheticParamsForExplicitSuper(CSourceClass callerClass, CMethod caller)
          For an explicit super class constructor invocation, returns the expressions that must be evaluated in the body of the constructor caller of the class callerClass to add the outer local variable values required by this to the stack.
 CFieldAccessorMethod getterOrSetterMethodFor(CField field, CExpressionContextType context)
          Returns a method that allows getting or setting the value of field from context context.
 CClassType getType()
          Returns the type of this class.
 CTypeVariable[] getTypeVariables()
          return the type variables of the class
 String getUniverseVersion()
          Get the version of the encoding used to encode the universe type modifiers.
 int hashCode()
           
 boolean hasProtectedVisibilityIn(CMemberHost from)
          Indicates whether this member is accessible from the given host when this member has protected visibility.
 boolean hasSyntheticOuterThis()
          Indicates whether the class represented by this should have a synthetic outer this field.
static void initSession()
          Initializes any non-final static items.
protected  CClassType[] innerClassesForAttribute()
          Collects all the inner classes that must be added to the InnerClasses attribute.
 boolean isAbstract()
           
abstract  boolean isAnonymous()
           
 boolean isClass()
          Indicates whether this host is a class.
 boolean isCompilationUnit()
          Indicates whether this host is a compilation unit
 boolean isDefinedInside(CMemberHost maybeOuter)
          Indicates whether this is defined inside the given host.
protected  boolean isFieldRedefined(String ident, CExpressionContextType dummyContext)
          Returns true iff a field with same name is already defined in a superclass or an implemented interface.
 boolean isGenericClass()
          Indicates whether this class is Generic Class
 boolean isInnerClass()
          Indicates whether this host is an inner class, i.e., a non-static member class.
 boolean isInterface()
           
abstract  boolean isMember()
          Indicates whether the class represented by this is a member type.
 boolean isNestedType()
          Indicates whether this host is a nested type, i.e., a member type.
 CMethodSet lookupAllMethods(CMethod m, CClassType[] args, CContextType context)
          Collects all the methods in the same GF as the argument method, visible in the given context, looking in parent hierarchy and augmentation map as needed.
 CClass lookupClass(String name, CContextType context)
          Searches for a class with the given simple name according the procedure in JLS2 6.5.5.
 CFieldAccessor lookupField(String name, CExpressionContextType context)
          Searches a field in current class and parent hierarchy as needed Creates an appropriate getter or setter method (or both) if necessary for privileged access to the field.
protected  CField lookupFieldHelper(String name, CExpressionContextType context)
          Searches a field in current class and parent hierarchy as needed
 CMethod lookupMethod(String name, CType[] params, CClassType[] args, CContextType context)
          Searches for the generic function applicable to the given identifier and argument type tuple, in the given context, looking in parent hierarchy and augmentation map as needed.
 CMethodSet lookupMethodOrSet(String name, CType[] params, CClassType[] argss, CContextType context)
          Searches for the generic function applicable to the given identifier and argument type tuple, in the given context, looking in parent hierarchy and augmentation map as needed.
 CMethodSet lookupMethodsSpecializedByMethod(CMethod specMethod, CClassType[] args, ArrayList needbridge, CContextType context)
          Searches for the methods specialized by a given method, in the given context, looking in parent hierarchy and augmentation map as needed.
 CMethodSet lookupMSAMethod(CMethod top, CType[] argTuple, CClassType[] argss, CContextType context)
          Searches for the most specific applicable method for the given argument tuple in the generic function to which the given method belongs in the given context, looking in parent hierarchy and augmentation map as needed.
 CMethod lookupOverloadedMethod(CMethod overloader, CClassType[] args, CContextType context)
          If overloader could be rewritten to dynamically specialize a method instead of statically overloading it, then this return said method.
 CField lookupSuperField(String name, CExpressionContextType context)
          Searches a field in current class and parent hierarchy as needed
 CMethod lookupTopConcreteMethod(CMethod method, CClassType[] args, CContextType context)
          Searches for the top concrete method of the generic function to which the given method belongs, in the given context, looking in the parent hierarchy and augmentation map as needed.
 CTypeVariable lookupTypeVariable(String ident)
           
protected  boolean memberNeedsPrivilegedAccess(CMember m, CContextType context)
          Indicates whether the given member needs a wrapper method
 CMethodSet methods()
          Returns the data structure representing the methods that will be used for generating bytecode.
protected  CMethodSet methodsForCodeGen()
          Returns the data structure representing the methods that will be used for generating bytecode.
 boolean nestedDescendsFrom(CClass maybeOuterSuper)
          Returns true if this host is a subclass of the given class or if some host of this host is a subclass of the given class.
 boolean noAssertionsYet()
          Returns a boolean indicating whether or not assertions have been found in this class as of yet.
 boolean noPossiblyInnerAssertionsYet()
          Returns a boolean indicating whether or not assertions have been found in this class or any inner classes as of yet.
private  boolean ownerOf(CTypeVariable typevariable)
          check whether this class si the owner of the given type variable
 String packageName()
          Gives the package name for this host.
 CMethodSet protoMethods()
          Returns the data structure representing the methods of this class as generated from the declarations after the checkInterface pass but before dispatcher wrapping.
 String qualifiedName()
           
 void register(CClass.Observer o)
          Registers the given observer to be notified when #setCheckedMembers() is called.
 void registerNestedType(CType type)
          Register a nested type visible inside this class.
 void rmjAnnotate(RMJAnnotation rmjInfo)
          Generate any RMJ annotations
 void setAssertHelperMethod(CMethod m)
          Set the synthetic helper method used to implement asserts.
 void setAssertStaticInitMethod(CAssertStaticInitMethod m)
          Set the static initializer for handling asserts.
 void setCheckedInterfaces(CClassType[] interfaces)
          Sets the interfaces extended or implemented by this type.
 void setCheckedMembers(CField[] fields_A, Hashtable fields_H, CMethod[] protoMethods_A)
          Stores information on member signatures gathered during checkInterface pass prior to closing in the translateMJ pass.
 void setInnerClasses(CClassType[] inners)
          End of first pass, we need the inner classes's signatures
 void setSuperClass(CClassType superClass)
          Sets the super class of this class
 void setTypeVariables(CTypeVariable[] typevariables)
          set the type variables of the class
 File sourceFile()
           
 void syntheticOuterThisInaccessible()
          Records the fact that even though the class is an inner class, we should not generate an outer this for it, because the outer this is not accessible.
 String toString()
           
private  CMethod wrapCallTo(CMethod method, boolean isSuper)
          Returns a package-protected wrapper method for forwarding calls to the given method.
 CMethod wrapSuperCallTo(CMethod method)
          Returns a wrapper method for forwarding qualified super method invocations from an inner class to the super class of this.
 
Methods inherited from class org.multijava.mjc.CMember
access, addModifiers, deprecated, getCCompilationUnit, getField, getIdent, getJavaName, getMethod, getOwnerName, getQualNameWithSeparator, hasDefaultAccess, host, ident, isAccessibleFrom, isDeclaredNonNull, isDeprecated, isFinal, isLocalTo, isPrivate, isProtected, isPublic, isStatic, modifiers, owner, setModifiers
 
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, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.multijava.mjc.CMemberHost
host, ident, isAccessibleFrom
 

Field Detail

CLS_UNDEFINED

public static final CClass CLS_UNDEFINED

compiler

private final Main compiler

sourceFile

private final File sourceFile

qualifiedName

private final String qualifiedName

interfaces

private CClassType[] interfaces

type

private CClassType type

innerClasses

private CClassType[] innerClasses

superClass

private CClassType superClass

visibleNestedTypes

private HashSet visibleNestedTypes
Tracks the nested and inner classes referred to within this class (whether or not their declarations are lexically enclosed in this class).

 private invariant (\forall Object o; visibleNestedTypes.contains(o);
                    o instanceof CClassType && ((CClassType)o).isNestedType() );
 


fields

private CFieldTable fields
Maps names to field signature for all the fields of this class.


methods

protected CMethodSet methods
The methods of this class after dispatcher wrapping.


protoMethods

private CMethodSet protoMethods
The methods of this class as generated from the declarations after the checkInterface pass but before dispatcher wrapping.


wrapperMethods

private CMethodSet wrapperMethods
The wrapper methods of this class


fieldGetterMethods

private CMethodSet fieldGetterMethods
The field getter methods of this class


fieldSetterMethods

private CMethodSet fieldSetterMethods
The field setter methods of this class


redirectorMethods

private CMethodSet redirectorMethods
Redirectors for inherited external methods that implement a regular Java interface.


assertHelperMethod

private CMethod assertHelperMethod
The synthetic methods used to implement assertions


assertStaticInitMethod

private CAssertStaticInitMethod assertStaticInitMethod

augMap

private CAugmentationMap augMap
Contains a mapping from contexts to the the set of augmenting methods for this class in each context.


NO_TOKEN

private static final TokenReference NO_TOKEN
Used for error reporting.


accessID

private static int accessID

syntheticIndex

private int syntheticIndex

dispClassTypes

protected CClassType[] dispClassTypes
Stores the dispatcher classes contained within the class or generic function anchor represented by this. This information is also included in innerClasses, but is stored separately here for use in generating MultiJava-specific bytecode attributes.


observerSet

private HashSet observerSet
Stores the observers that are to be notified when #setCheckedMembers() is called. Lazily initialized.


typevariables

private CTypeVariable[] typevariables

syntheticOuterThisInaccessible

private boolean syntheticOuterThisInaccessible
Flag is true if we are not generating a synthetic outer 'this' field for this inner class, because the outer this is not accessible. This is the case when the outer this has not yet been fully constructed -- the inner class is created in the outer class's constructor, before the superclass constructor has been called.

Constructor Detail

CClass

public CClass(Main compiler,
              MemberAccess access,
              File sourceFile,
              String ident,
              String qualifiedName,
              CClassType superClass,
              boolean deprecated)
Constructs a class signature.

ensures owner != null ==> owner == host();
ensures owner == null ==> host().isCompilationUnit();
 

Method Detail

setCheckedInterfaces

public void setCheckedInterfaces(CClassType[] interfaces)
Sets the interfaces extended or implemented by this type. Called during checkInterface pass before checking the signatures of members, since the super-interfaces must be known to resolve type signatures of members. Subtyping relationships can be tested after this information has been set (for both classes and all their ancestors).

requires interfaces != null && 
(\forall int i; 0 <= i && i < interfaces.length;
interfaces[i].isChecked());
 


setCheckedMembers

public final void setCheckedMembers(CField[] fields_A,
                                    Hashtable fields_H,
                                    CMethod[] protoMethods_A)
Stores information on member signatures gathered during checkInterface pass prior to closing in the translateMJ pass. Method and field lookup is possible after this method has been called, however, code generation must wait until after the close method has been called.

 requires (fields_A != null || fields_H != null);
 requires protoMethods_A != null;
 ensures observerSet != null ==>
         (\forall Observer o; observerSet.contains(o); 
                              (* calls o.signatureCompleted(this) *) );
 


close

public void close(CMethod[] methods_A,
                  CClassType[] dispClassTypes)
Ends the definition of this class by adding the dispatcher-wrapped methods and inner-dispatcher classes.

 requires methods_A != null && dispClassTypes != null;
 assignable methods, innerClasses, this.dispClassTypes;
 ensures (* getInnerClasses() will return the union of 
            \old(getInnerClasses()) and dispClassTypes *);
                  // !FIXME! Why does JML checker require the signature
                  // for setInnerClasses here even though there is no 
                  // overloading?
 callable getInnerClasses, setInnerClasses(CClassType[]);
 


getCompiler

public Main getCompiler()
Returns the compiler


getCClass

public CClass getCClass()
Overrides:
getCClass in class CMember
Returns:
the interface

setTypeVariables

public void setTypeVariables(CTypeVariable[] typevariables)
set the type variables of the class


getTypeVariables

public CTypeVariable[] getTypeVariables()
return the type variables of the class


isClass

public boolean isClass()
Indicates whether this host is a class.

Specified by:
isClass in interface CMemberHost
Returns:
true iff this host represents a class

isNestedType

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

Specified by:
isNestedType in interface CMemberHost

isInnerClass

public boolean isInnerClass()
Indicates whether this host is an inner class, i.e., a non-static member class.

Specified by:
isInnerClass in interface CMemberHost

isCompilationUnit

public boolean isCompilationUnit()
Indicates whether this host is a compilation unit

Specified by:
isCompilationUnit in interface CMemberHost
Returns:
true iff this host represents a compilation unit

isAbstract

public boolean isAbstract()
Returns:
true if this member is abstract

isAnonymous

public abstract boolean isAnonymous()
Returns:
true if this class is anonymous

isMember

public abstract boolean isMember()
Indicates whether the class represented by this is a member type. A member type is a type that is declared inside another type but that is not an anonymous class or a local type declaration.


isInterface

public boolean isInterface()
Returns:
true if this class is an interface

syntheticOuterThisInaccessible

public void syntheticOuterThisInaccessible()
Records the fact that even though the class is an inner class, we should not generate an outer this for it, because the outer this is not accessible.


hasSyntheticOuterThis

public boolean hasSyntheticOuterThis()
Indicates whether the class represented by this should have a synthetic outer this field. That is true if the class is an inner class and the outer this is accessible.


getSuperType

public CClassType getSuperType()
Returns the supertype of this class or null if this is the java.lang.Object class.

Returns:
The supertype of this class or null if this is the java.lang.Object class.

getInterfaces

public CClassType[] getInterfaces()
Returns:
an array of the interfaces implemented by this class

qualifiedName

public String qualifiedName()
Overrides:
qualifiedName in class CMember
Returns:
the full name of this class

packageName

public String packageName()
Description copied from interface: CMemberHost
Gives the package name for this host.

Specified by:
packageName in interface CMemberHost
Returns:
the name of the package this class belongs to

getSuperClass

public CClass getSuperClass()
Returns the super class of this class


getGenericSignature

public String getGenericSignature()

setSuperClass

public void setSuperClass(CClassType superClass)
Sets the super class of this class


getType

public CClassType getType()
Returns the type of this class. Ensures that the type has been checked.


sourceFile

public File sourceFile()
Returns:
the source file of this class

getDeclaredField

protected CField getDeclaredField(String ident)
Returns the signature of the field with the given name declared in this class, or null if this class does not declare a field with the given name.


fields

public Collection fields()
Returns a Collection of CField values, one for each field in this class.


getFieldCount

public int getFieldCount()
Returns the number of fields in this class.


getInnerClasses

public CClassType[] getInnerClasses()
Returns an array of the types of the inner classes of the class represented by this.

 ensures \result != null;
 


setInnerClasses

public void setInnerClasses(CClassType[] inners)
End of first pass, we need the inner classes's signatures


toString

public String toString()
Overrides:
toString in class Object

compareTo

public int compareTo(Object o)
              throws ClassCastException
Compares this to a given object.

also
requires this.equals(o);
ensures \result == 0;
also
requires o != null && !(o instanceof CClass);
signals_only ClassCastException;
 

Specified by:
compareTo in interface Comparable
Parameters:
o - an Object value to compare to this
Returns:
0 if this.equals(o)
Throws:
ClassCastException - if o is incomparable to this

equals

public boolean equals(Object o)
               throws ClassCastException
Compares the fully qualified name of this with the fully qualified name of o.

Overrides:
equals in class Object
Throws:
ClassCastException - if o is not an instance of CClass

also
requires (o instanceof CClass);
ensures this.qualifiedName().equals(((CClass)o).qualifiedName());
also
requires !(o instanceof CClass);
signals_only ClassCastException;
 

hashCode

public int hashCode()
Overrides:
hashCode in class Object

descendsFrom

public boolean descendsFrom(CClass maybeSuper)
Indicates whether this host is a subclass of the given class, where "subclass" is the reflexive, transitive closure of the extends relation.

Specified by:
descendsFrom in interface CMemberHost
Parameters:
maybeSuper - the potential superclass

descendsFrom

public boolean descendsFrom(CClassType maybeSuper,
                            CClassType maybeSub)

Returns whether the given maybeSuper type is a supertype of the maybeSub type. These CClassTypes are thereby necessary when checking for a subtype relationship on generic classes since in such cases the actual type arguments are required in order to check for the subtype relationship. If the classes involved are not generic, the overloaded method descendsFrom(CClass) may be used instead.

Note that when invoking this method from outside this class, the maybeSub type should be a type of this class.

Parameters:
maybeSuper - The potential supertype.
maybeSub - The potential subtype.
Returns:
Whether maybeSuper is a supertype of maybeSub.

nestedDescendsFrom

public boolean nestedDescendsFrom(CClass maybeOuterSuper)
Returns true if this host is a subclass of the given class or if some host of this host is a subclass of the given class.

Specified by:
nestedDescendsFrom in interface CMemberHost
Parameters:
maybeOuterSuper - the potential superclass

isDefinedInside

public boolean isDefinedInside(CMemberHost maybeOuter)
Indicates whether this is defined inside the given host.

Specified by:
isDefinedInside in interface CMemberHost
Parameters:
maybeOuter - the host that this may be inside
Returns:
true if the given host is a (possibly transitive) host of this

directlyVisibleTypes

public Collection directlyVisibleTypes()
Returns the set of types (excluding non-reference types) that are directly visible from this class. The directly visible types are those referenced in the signature of this class.


methodsForCodeGen

protected CMethodSet methodsForCodeGen()
Returns the data structure representing the methods that will be used for generating bytecode. The returned data structure is not cloned but is aliased by this; handle with care.

See Also:
methods

methods

public CMethodSet methods()
Returns the data structure representing the methods that will be used for generating bytecode. The returned data structure is not cloned but is aliased by this; handle with care.

See Also:
methods

protoMethods

public CMethodSet protoMethods()
Returns the data structure representing the methods of this class as generated from the declarations after the checkInterface pass but before dispatcher wrapping. The returned data structure is not cloned but is aliased by this; thus, it should be handled with care. dispatcher wrapping.

See Also:
protoMethods

fieldsForCodeGen

protected CFieldTable fieldsForCodeGen()
Returns the data structure representing the fields that will be used for generating bytecode. The returned data structure is not cloned but is aliased by this; handle with care.

See Also:
fields

getNextAccessName

public static String getNextAccessName()

initSession

public static void initSession()
Initializes any non-final static items.


getNextSyntheticIndex

public int getNextSyntheticIndex()
Returns a unique int for use in naming synthetic classes (e.g. anonymous classes).

Returns:
an unique int value incrementaly

setAssertHelperMethod

public void setAssertHelperMethod(CMethod m)
Set the synthetic helper method used to implement asserts.


setAssertStaticInitMethod

public void setAssertStaticInitMethod(CAssertStaticInitMethod m)
Set the static initializer for handling asserts. If there already exists a static initializer method for this class, remove it.


noAssertionsYet

public boolean noAssertionsYet()
Returns a boolean indicating whether or not assertions have been found in this class as of yet.


noPossiblyInnerAssertionsYet

public boolean noPossiblyInnerAssertionsYet()
Returns a boolean indicating whether or not assertions have been found in this class or any inner classes as of yet.


lookupClass

public CClass lookupClass(String name,
                          CContextType context)
                   throws UnpositionedError
Searches for a class with the given simple name according the procedure in JLS2 6.5.5. This method implements the second and third bullet points of the procedure. That is "Otherwise, if the simple type name occurs within the scope of exactly one visible member type, then the simple type name denotes that member type;" and "Otherwise, if the simple type name occurs within the scope of more than one visible member type, then the name is ambiguous as a type name; a compile-time error occurs."

Parameters:
name - the class name, without qualifiers
context - the referencing context, used for accessibility checks
Returns:
the class if found, null otherwise
Throws:
UnpositionedError - if search fails

lookupTypeVariable

public CTypeVariable lookupTypeVariable(String ident)

checkTypeVariables

public void checkTypeVariables(CContextType context)
                        throws UnpositionedError
Performs the typechecking for the type variables of this class.

Parameters:
context - The type checking context.
Throws:
UnpositionedError - if some error occurs during type checking.

getSubstitution

public CClassType getSubstitution(CTypeVariable typevariable,
                                  CClassType[][] sub)
When a generic type is instantiated, the type variables should be substituted with the type arguments, This method returns the corresponding type arguments for the type variable


getSubstitution

public CClassType getSubstitution(CTypeVariable typevariable,
                                  CClassType[] sub)

getSuperSubstitution

public CClassType getSuperSubstitution(CClassType supertype,
                                       CTypeVariable typeVar)

ownerOf

private boolean ownerOf(CTypeVariable typevariable)
check whether this class si the owner of the given type variable


lookupField

public CFieldAccessor lookupField(String name,
                                  CExpressionContextType context)
                           throws UnpositionedError
Searches a field in current class and parent hierarchy as needed Creates an appropriate getter or setter method (or both) if necessary for privileged access to the field.

Parameters:
name - the simple name of the field
context - the context in which the reference appears, used for accessibility checks
Throws:
UnpositionedError - this error will be positioned soon

lookupFieldHelper

protected CField lookupFieldHelper(String name,
                                   CExpressionContextType context)
                            throws UnpositionedError
Searches a field in current class and parent hierarchy as needed

Parameters:
name - the simple name of the field
context - the context in which the reference appears, used for accessibility checks
Throws:
UnpositionedError - this error will be positioned soon

lookupSuperField

public CField lookupSuperField(String name,
                               CExpressionContextType context)
                        throws UnpositionedError
Searches a field in current class and parent hierarchy as needed

Parameters:
name - the simple name of the field
context - the context in which the reference appears, used for accessibility checks
Throws:
UnpositionedError - this error will be positioned soon

isFieldRedefined

protected boolean isFieldRedefined(String ident,
                                   CExpressionContextType dummyContext)
                            throws UnpositionedError
Returns true iff a field with same name is already defined in a superclass or an implemented interface.

Parameters:
ident - the name of the field
Throws:
UnpositionedError

augmentWithMethod

public void augmentWithMethod(CMethod m,
                              CCompilationUnitContextType c)

lookupMethod

public CMethod lookupMethod(String name,
                            CType[] params,
                            CClassType[] args,
                            CContextType context)
                     throws UnpositionedError
Searches for the generic function applicable to the given identifier and argument type tuple, in the given context, looking in parent hierarchy and augmentation map as needed. The receiver is assumed to be the type represented by this.

Parameters:
name - method name
params - method parameter types
context - the context in which the method reference should be resolved, used to identify the external methods augmenting this class
Returns:
a method of the most specific applicable generic function
Throws:
UnpositionedError - if the result is ambiguous

lookupMethodOrSet

public CMethodSet lookupMethodOrSet(String name,
                                    CType[] params,
                                    CClassType[] argss,
                                    CContextType context)
                             throws UnpositionedError
Searches for the generic function applicable to the given identifier and argument type tuple, in the given context, looking in parent hierarchy and augmentation map as needed. The receiver is assumed to be the type represented by this.

Parameters:
name - method name
params - method parameter types
context - the context in which the method reference should be resolved, used to identify the external methods augmenting this class
Returns:
set of methods of the most specific applicable generic function
Throws:
UnpositionedError - if the result is ambiguous

lookupMethodsSpecializedByMethod

public CMethodSet lookupMethodsSpecializedByMethod(CMethod specMethod,
                                                   CClassType[] args,
                                                   ArrayList needbridge,
                                                   CContextType context)
                                            throws UnpositionedError
Searches for the methods specialized by a given method, in the given context, looking in parent hierarchy and augmentation map as needed.

Parameters:
specMethod - the method that is doing the specializing
context - the context in which the method reference should be resolved, used to identify the external methods augmenting this class
Returns:
A set of methods, all with the same static type tuple and ident as specMethod, such that specMethod immediately specializes each method in the set in the given context.
Throws:
UnpositionedError - if the result is ambiguous

lookupTopConcreteMethod

public CMethod lookupTopConcreteMethod(CMethod method,
                                       CClassType[] args,
                                       CContextType context)
                                throws UnpositionedError
Searches for the top concrete method of the generic function to which the given method belongs, in the given context, looking in the parent hierarchy and augmentation map as needed.

Parameters:
method - the method from which to begin the search
context - the context in which the method reference should be resolved. Used to identify the external methods augmenting this class and to determine the accessibility of the methods found.
Returns:
the top concrete method of the generic function
Throws:
UnpositionedError - if the result is ambiguous

lookupMSAMethod

public CMethodSet lookupMSAMethod(CMethod top,
                                  CType[] argTuple,
                                  CClassType[] argss,
                                  CContextType context)
                           throws UnpositionedError
Searches for the most specific applicable method for the given argument tuple in the generic function to which the given method belongs in the given context, looking in parent hierarchy and augmentation map as needed.

Parameters:
top - the method that denotes the generic function
argTuple - the tuple of argument types
context - the context in which the method reference should be resolved, used to identify the external methods augmenting this class
Returns:
the set of most specific applicable methods, or null if none
Throws:
UnpositionedError - if the result is ambiguous and it can't be resolved through external means (e.g. via glue methods)

lookupAllMethods

public CMethodSet lookupAllMethods(CMethod m,
                                   CClassType[] args,
                                   CContextType context)
                            throws UnpositionedError
Collects all the methods in the same GF as the argument method, visible in the given context, looking in parent hierarchy and augmentation map as needed.

Parameters:
m - a method in the generic function being gathered
context - the context in which the method reference should be resolved, used to identify the external methods augmenting this class
Returns:
the set of methods in the GF, or null if none
Throws:
UnpositionedError - if there was an error

lookupOverloadedMethod

public CMethod lookupOverloadedMethod(CMethod overloader,
                                      CClassType[] args,
                                      CContextType context)
                               throws UnpositionedError
If overloader could be rewritten to dynamically specialize a method instead of statically overloading it, then this return said method. Otherwise this returns null.

Parameters:
overloader - the method to be checked
context - the context in which the method is declared
Throws:
UnpositionedError

accumMostSpecificMethods

protected void accumMostSpecificMethods(String name,
                                        CClass.NoDupStrategy actor,
                                        CMethodSet accum,
                                        CClassType[] args,
                                        CContextType context)
                                 throws UnpositionedError
Accumulates the set of methods with identifier name declared in the type represented by this, or added to the type by external methods, using the strategy actor. Only searches supertypes if no matches have been accumulated while searching the type represented by this.

Parameters:
name - method name
actor - the strategy for selecting methods
accum - a method set in which to accumulate the results
context - the context in which the method reference appears, used for resolving augmenting
Throws:
UnpositionedError - at the discretion of the strategy actor

accumLocalInternalMethods

protected void accumLocalInternalMethods(String name,
                                         CClass.NoDupStrategy actor,
                                         CMethodSet accum,
                                         CClassType[] args)
                                  throws UnpositionedError
Accumulates the set of methods with identifier name declared in the type represented by this, using the strategy actor. Searches neither external methods nor supertypes.

Parameters:
name - method name
actor - the strategy for selecting methods
accum - a method set in which to accumulate the results
Throws:
UnpositionedError - at the discretion of the strategy actor

accumLocalExtAndInheritedMethods

protected final void accumLocalExtAndInheritedMethods(String name,
                                                      CClass.NoDupStrategy actor,
                                                      CMethodSet accum,
                                                      CClassType[] args,
                                                      CContextType context)
                                               throws UnpositionedError
Accumulates the set of methods with identifier name declared in the type represented by this, or added to the type by external methods, using the strategy actor. Always searches supertypes.

Parameters:
name - method name
actor - the strategy for selecting methods
accum - a method set in which to accumulate the results
context - the context in which the method reference appears, used for resolving augmenting
Throws:
UnpositionedError - at the discretion of the strategy actor

getAbstractMethods

public CMethodSet.MethodArgsPair[] getAbstractMethods()
Returns a list of abstract methods


getInterfaceMethods

public CMethodSet.MethodArgsPair[] getInterfaceMethods()
Returns a list of interface methods


addBridgeMethod

public void addBridgeMethod(CMethod me,
                            CContextType context)
                     throws UnpositionedError
Throws:
UnpositionedError

checkBridgeMethod

public void checkBridgeMethod(CMethod me,
                              CClassType[] args,
                              CContextType context)
                       throws UnpositionedError
Throws:
UnpositionedError

getAllMethods

public void getAllMethods(ArrayList v)
Walks up the extends hierarchy and adds all methods to the given list.

Parameters:
v - mutated to include the CMethods for all methods in this class and all direct ancestors

getAllInheritedMethods

public ArrayList getAllInheritedMethods()
Return all methods that are inherited from supertypes, except for those overridden in this class.


getAllInheritableMethods

public void getAllInheritableMethods(ArrayList v)
Walks up the extends and implements hierarchies and adds all inheritable methods to the given list, v, if methods of the same signature are not already contained in v.


getUniverseVersion

public String getUniverseVersion()
Get the version of the encoding used to encode the universe type modifiers. This is only meaningful in CSourceClass (where it indicates which version the compiler is using) and CBinaryClass (where it indicates which version has been used in the class file). By AHS.


collectAbstractMethods

public void collectAbstractMethods(ArrayList v,
                                   CClassType[] args)
Walks up the extends hierarchy and adds all abstract methods to the given list.

Parameters:
v - mutated to include the CMethods for all abstract methods in this class and all direct ancestors

collectInterfaceMethods

public void collectInterfaceMethods(ArrayList v,
                                    CClassType[] args)
Walks up the implements and extends hierarchies and adds all methods of interfaces to the given list.

Parameters:
v - mutated to include the CMethods for all interface methods in this class and all its ancestors

getIdentFrom

protected static String getIdentFrom(String qualifiedName)
Returns:
the short name of this class

hasProtectedVisibilityIn

public boolean hasProtectedVisibilityIn(CMemberHost from)
Indicates whether this member is accessible from the given host when this member has protected visibility. In this case, protected classes are accessible from subclasses of their lexically enclosing classes.

Overrides:
hasProtectedVisibilityIn in class CMember
Parameters:
from - the host that wants access
Returns:
true iff the given host is allowed access to this member

addField

public void addField(CSourceField field)
Add inner fields


registerNestedType

public void registerNestedType(CType type)
Register a nested type visible inside this class.

 requires type instanceof CClassType && type.isNestedType();
 


memberNeedsPrivilegedAccess

protected boolean memberNeedsPrivilegedAccess(CMember m,
                                              CContextType context)
Indicates whether the given member needs a wrapper method

Parameters:
m - the member to check
context - the context of the method access

getterOrSetterMethodFor

public CFieldAccessorMethod getterOrSetterMethodFor(CField field,
                                                    CExpressionContextType context)
Returns a method that allows getting or setting the value of field from context context. Called when a legal access to the field is made from a context that does not have access to the field in the JVM, i.e., an inner or outer class accessing a private field or a superclass field.


findAccessorMethod

private CFieldAccessorMethod findAccessorMethod(CField f,
                                                CMethodSet ms)

findGetterMethod

public CFieldAccessorMethod findGetterMethod(CField f)

findOrCreateGetterMethod

public CFieldAccessorMethod findOrCreateGetterMethod(CField f)

findOrCreateSetterMethod

public CFieldAccessorMethod findOrCreateSetterMethod(CField f)

wrapSuperCallTo

public CMethod wrapSuperCallTo(CMethod method)
                        throws UnpositionedError
Returns a wrapper method for forwarding qualified super method invocations from an inner class to the super class of this. Creates and adds the wrapper method to this if it does not already exist.

 requires this.getSuperClass() == method.owner();
 

Throws:
UnpositionedError

wrapCallTo

private CMethod wrapCallTo(CMethod method,
                           boolean isSuper)
                    throws UnpositionedError
Returns a package-protected wrapper method for forwarding calls to the given method. The wrapper is needed for inner or outer classes for which the virtual machine denies access to method. These denials stem from the virtual machine not understanding inner classes. For example, private methods of an outer class do not appear to be accessible from an inner class in the JVM.

Throws:
UnpositionedError

addRedirector

public void addRedirector(CSourceRedirectorMethod redir)
Adds a synthetic redirector method to this.


genClassFile

public void genClassFile(Destination dest)
                  throws IOException,
                         ClassFileFormatException
Generate the code in a class file. Uses several protected helper methods so subclasses can override portions of the behavior.

Parameters:
dest - the destination directory of the class file
Throws:
IOException
ClassFileFormatException
See Also:
genInterfaces(), genMethods(), genFields(), genInners()

createClassInfo

protected ClassInfo createClassInfo(long modifiers,
                                    String superClass,
                                    File sourceFile)
Creates an instance of ClassInfo. This is a factory method for subclasses to generate a refined ClassInfo object.


genInterfaces

protected ClassConstant[] genInterfaces()
Returns an array representing (for bytecode) the qualified names of the implemented interfaces.


genMethods

protected MethodInfo[] genMethods()
Returns an array representing all the methods for bytecode.


genFields

protected FieldInfo[] genFields()
Returns an array representing all the fields for bytecode.


genCustomAttributes

protected final AttributeList genCustomAttributes()
Returns an attribute list containing all the custom attributes to be added to the top-level classinfo generated for this. Regular Java attributes will be added later.


appendCustomAttributes

protected void appendCustomAttributes(AttributeList accum)
Appends any custom attributes for this class to the attribute list represented by accum.


genGenericFunctions

protected void genGenericFunctions(ArrayList accum)
Accumulates an array of all the required gf_info data structures for this.


genInners

protected InnerClassInfo[] genInners()
Returns an array representing (for bytecode) the type signatures of the inner and nested classes.


innerClassesForAttribute

protected CClassType[] innerClassesForAttribute()
Collects all the inner classes that must be added to the InnerClasses attribute. This is a hook method so that a subclass can override it; e.g., JML overrides this method to combine inner classes through the refinement chain.


genInnerInfo

public InnerClassInfo genInnerInfo()
Generates the inner class info record for this.

 requires isNestedType();
 


genConstructorArray

public CType[] genConstructorArray(CType[] params)
Mutates the given array to add any synthetic parameters for outer local variables referenced within the class represented by this.

 requires (* this represents an anonymous class or 
             a local class declaration *);
 requires (* params is the parameter array for a constructor of this *);
 ensures (* params includes the types of any outer local variables 
            required to instantiate this *);
 


genSyntheticParams

public void genSyntheticParams(CodeSequence code)
Adds synthetic parameters to the code sequence for a call to this class's constructor. In other words, it does nothing, except for anonymous classes and inner class declarations that reference final local variables. In those cases, this adds code to push the local variable values onto the stack.

Parameters:
code - the code sequence being generated

genSyntheticParamsForExplicitThis

public void genSyntheticParamsForExplicitThis(CodeSequence code,
                                              CMethod constructor)
Adds synthetic parameters to the code sequence for an explicit constructor invocation to this class's constructor. In other words, it does nothing, except for anonymous classes and inner class declarations that reference final local variables. In those cases, this adds code to push the local variable values onto the stack.

Parameters:
code - the code sequence being generated
constructor - the signature of the calling constructor

getSyntheticParamsForExplicitSuper

public JExpression[] getSyntheticParamsForExplicitSuper(CSourceClass callerClass,
                                                        CMethod caller)
For an explicit super class constructor invocation, returns the expressions that must be evaluated in the body of the constructor caller of the class callerClass to add the outer local variable values required by this to the stack.

 requires callerClass.descendsFrom(this);
 requires caller.isConstructor();
 ensures \result != null;
 


rmjAnnotate

public void rmjAnnotate(RMJAnnotation rmjInfo)
Generate any RMJ annotations


register

public void register(CClass.Observer o)
Registers the given observer to be notified when #setCheckedMembers() is called.


isGenericClass

public boolean isGenericClass()
Indicates whether this class is Generic Class


mjc

mjc is Copyright (C) 2000-2004 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. mjc is based in part on the Kopi project Copyright (C) 1990-99 DMS Decision Management Systems Ges.m.b.H.