|
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.CMember
org.multijava.mjc.CClass
org.multijava.mjc.CSourceClass
org.jmlspecs.checker.JmlSourceClass
A class for representing JML classes read from *.java files. It is primarily just a data structure, apart from methods for generating the qualified name and for determining whether the member is accessible from some class.
CMember| Nested Class Summary |
| Nested classes inherited from class org.multijava.mjc.CClass |
CClass.NoDupStrategy, CClass.Observer |
| Field Summary | |
private boolean |
finishedPreProcessing
|
protected int |
levelNumber
The level number is determined by the suffix of the source file. |
private static CField |
modelField
|
protected JmlSourceClass |
refinedSourceClass
This field contains the source class of the type declaration that is refined by the current type; it is used when looking up names such as fields or classes. |
protected JmlSourceClass |
refiningSourceClass
|
private static int |
stackLevel
|
private JmlMemberDeclaration |
typeAST
|
| Fields inherited from class org.multijava.mjc.CSourceClass |
|
| Fields inherited from class org.multijava.mjc.CClass |
CLS_UNDEFINED, dispClassTypes, methods |
| 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_PURE, AMID_JAVA_MATH, AMID_MAX, AMID_SAFE_MATH, CMP_VERSION, 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, 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 |
| Constructor Summary | |
JmlSourceClass(Main compiler,
CClass owner,
CMemberHost host,
TokenReference where,
long modifiers,
String ident,
String qualifiedName,
boolean isAnonymous,
boolean isMember,
boolean deprecated)
Constructs a class export from source |
|
| Method Summary | |
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. |
private void |
accumMethodsJMLOnly(CClass.NoDupStrategy actor,
String name,
CMethodSet accum)
Accumulates the set of methods with identifier name declared in the type represented by this,
ignoring external methods, 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 |
checkFileNameAndSuffix(JmlSourceClass refinedType)
This method ensures that a file at a lower level only refines a file at the same or higher level; but this check is only done on the most refined definition of a class. |
int |
classesRefined()
|
protected int |
compareLevelsTo(JmlSourceClass other)
|
int |
compareTo(Object o)
Compares this to a given object. |
static int |
computeSuffixNumber(String fileName)
Computes the number associated with the suffix of the given file name. |
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. |
private static CMethodSet.MethodArgsPair[] |
filterModelMethods(CMethodSet.MethodArgsPair[] methods)
Filters out all model methods and returns only non-model methods. |
void |
finishSymbolTable()
Finishes pre-processing of this type so it can be used as a symbol table. |
void |
finishSymbolTableForInterfaces()
|
protected FieldInfo[] |
genFields()
Returns an array representing all the fields for bytecode. |
protected MethodInfo[] |
genMethods()
Returns an array representing all the methods for bytecode. |
CMethodSet.MethodArgsPair[] |
getAbstractMethods()
Returns a list of abstract methods. |
JmlMemberDeclaration |
getAST()
Returns the AST for this method. |
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. |
protected CClass |
getDeclaredInnerType(String name)
Searches for the inner type with the given name. |
CMethodSet.MethodArgsPair[] |
getInterfaceMethods()
Returns a list of interface methods. |
int |
getLevelNumber()
|
JmlSourceClass |
getMostRefined()
|
JmlSourceClass |
getRefinedType()
Returns the refined 'JmlSourceClass' for this class |
JmlSourceClass |
getRefiningType()
Returns the refining 'JmlSourceClass' for this class |
CClass |
getSuperClass()
Returns the super class of this class |
boolean |
inJavaFile()
Returns true if this member is declared in a '.java' file. |
protected CClassType[] |
innerClassesForAttribute()
Collects all the inner classes that must be added to the InnerClasses attribute. |
boolean |
inSpecFile()
Returns true if this member is declared in a '.spec' file. |
boolean |
isAccessibleFrom(CMemberHost from)
Indicates whether this is accessible from the given host. |
boolean |
isEffectivelyModel()
Returns true iff this class should be treated as a model class; the class itself is defined as model or it is defined in a model class or interface. |
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 |
isFinishedPreProcessing()
Returns true if this member has finished the pre-processing needed so it can be used as a symbol table, i.e., the type has been processed through the checkInitializer phase. |
boolean |
isGhost()
returns true iff this class is explicitly annotated with the ghost modifier. |
boolean |
isLocalTo(CMemberHost from)
Indicates whether the declaration of this member is local to the given host. |
boolean |
isModel()
returns true iff this class is explicitly annotated with the model modifier. |
boolean |
isMoreRefinedThan(JmlSourceClass j)
Returns true if the calling object is more refined (perhaps in more than one step) than the argument; Returns false if they are the same object or the calling argument is less refined or they are not part of the same refinement seqeuence. |
boolean |
isRefined()
|
boolean |
isRefiningType()
|
JmlMemberAccess |
jmlAccess()
|
protected CField |
lookupFieldHelper(String name,
CExpressionContextType context)
Searches a field in current class and parent hierarchy as needed |
CMethodSet |
lookupJMLMethodName(String name,
CContextType context)
For looking up methods that are not overloaded and appear in JML clauses that list method calls. |
(package private) CMethodSet |
lookupJMLMethodsWithSameSig(CMethod specMethod)
Searches for the methods with the same signature as the given method, looking in parent hierarchy as needed. |
JmlSourceField |
lookupRefinedField(CField specField)
Searches for the field refined by a given field, looking in the refinement hierarchy as needed. |
JmlSourceClass |
lookupRefinedInnerType(CClass specType)
Searches for the inner type refined by a given inner type, looking in the refinement hierarchy as needed. |
JmlSourceMethod |
lookupRefinedMethod(CMethod specMethod)
Searches for the method refined by a given method, looking in the refinement hierarchy as needed. |
protected boolean |
refines(Object maybeRefined)
|
void |
setAST(JmlMemberDeclaration typeAST)
Sets the AST for this method. |
void |
setFinishedPreProcessing()
Sets the flag to true that this member has finished the pre-processing needed so it can be used as a symbol table, i.e., the type has been processed through the checkInitializer phase. |
void |
setRefinedType(JmlSourceClass refinedType)
Sets the refinedType field of this
JmlSourceClass object. |
| Methods inherited from class org.multijava.mjc.CMember |
access, deprecated, getCCompilationUnit, getField, getIdent, getJavaName, getMethod, getOwnerName, getQualNameWithSeparator, hasDefaultAccess, host, ident, isDeprecated, isFinal, 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 |
| Field Detail |
protected int levelNumber
private static CField modelField
private static int stackLevel
protected JmlSourceClass refinedSourceClass
protected JmlSourceClass refiningSourceClass
private JmlMemberDeclaration typeAST
private boolean finishedPreProcessing
| Constructor Detail |
public JmlSourceClass(Main compiler,
CClass owner,
CMemberHost host,
TokenReference where,
long modifiers,
String ident,
String qualifiedName,
boolean isAnonymous,
boolean isMember,
boolean deprecated)
| Method Detail |
public CClass getSuperClass()
getSuperClass in class CClass
public void checkFileNameAndSuffix(JmlSourceClass refinedType)
throws UnpositionedError
computeSuffixNumber.
UnpositionedErrorpublic JmlSourceClass getRefinedType()
public JmlSourceClass getRefiningType()
public boolean isMoreRefinedThan(JmlSourceClass j)
public void setRefinedType(JmlSourceClass refinedType)
refinedType field of this
JmlSourceClass object.
Throws an exception if setting this field would have created
a cycle in the refinement sequence.
public boolean isRefiningType()
public boolean isRefined()
public JmlSourceClass getMostRefined()
public int classesRefined()
public void setAST(JmlMemberDeclaration typeAST)
public JmlMemberDeclaration getAST()
public int compareTo(Object o)
throws ClassCastException
also requires (o instanceof JmlSourceClass) && qualifiedName().equals(((JmlSourceClass)o).qualifiedName()); ensures (* \result is ordered according to suffix of the source files *); also requires !(o instanceof JmlSourceClass); signals_only ClassCastException;
compareTo in interface ComparablecompareTo in class CClasso - an Object value to compare to this
ClassCastException - if o is incomparable to thisprotected int compareLevelsTo(JmlSourceClass other)
public int getLevelNumber()
public boolean descendsFrom(CClass maybeSuper)
descendsFrom in interface CMemberHostdescendsFrom in class CClassmaybeSuper - the potential superclassprotected boolean refines(Object maybeRefined)
protected CField lookupFieldHelper(String name,
CExpressionContextType context)
throws UnpositionedError
lookupFieldHelper in class CClassname - the simple name of the fieldcontext - the context in which the reference appears, used
for accessibility checks
UnpositionedError - this error will be positioned soonprotected CField getDeclaredField(String ident)
getDeclaredField in class CClass
protected boolean isFieldRedefined(String ident,
CExpressionContextType dummyContext)
throws UnpositionedError
isFieldRedefined in class CClassident - the name of the field
UnpositionedErrorpublic boolean isAccessibleFrom(CMemberHost from)
isAccessibleFrom in interface CMemberHostisAccessibleFrom in class CMemberfrom - the host that wants access
public boolean isLocalTo(CMemberHost from)
CMember for an explanation of
those two cases). The additional case involves refinement and
is necessary for private fields, methods, and classes
declared inside a class declaration refined by the host of
this member.
isLocalTo in class CMemberfrom - the given hostpublic boolean isEffectivelyModel()
isEffectivelyModel in interface org.jmlspecs.util.classfile.JmlModifiablepublic boolean isModel()
isModel in interface org.jmlspecs.util.classfile.JmlModifiablepublic boolean isGhost()
isGhost in interface org.jmlspecs.util.classfile.JmlModifiablepublic CMethodSet.MethodArgsPair[] getAbstractMethods()
getAbstractMethods in class CClasspublic CMethodSet.MethodArgsPair[] getInterfaceMethods()
getInterfaceMethods in class CClass
protected void accumMostSpecificMethods(String name,
CClass.NoDupStrategy actor,
CMethodSet accum,
CClassType[] args,
CContextType context)
throws UnpositionedError
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.
In this overriding method, we also accumulate methods from the
refined class declaration of the refines clause, but only if no
matches have been accumulated from this type and its
supertypes.
accumMostSpecificMethods in class CClassname - method nameactor - the strategy for selecting methodsaccum - a method set in which to accumulate the
resultscontext - the context in which the method reference
appears, used for resolving augmenting
UnpositionedError - at the discretion of the strategy
actor private static CMethodSet.MethodArgsPair[] filterModelMethods(CMethodSet.MethodArgsPair[] methods)
public static int computeSuffixNumber(String fileName)
public void finishSymbolTable()
public void finishSymbolTableForInterfaces()
protected void accumLocalInternalMethods(String name,
CClass.NoDupStrategy actor,
CMethodSet accum,
CClassType[] args)
throws UnpositionedError
name declared in the type represented by this,
using the strategy actor. Searches neither
external methods nor supertypes.
This overriding method does, however, search refining types.
accumLocalInternalMethods in class CClassname - method nameactor - the strategy for selecting methodsaccum - a method set in which to accumulate the
results
UnpositionedError - at the discretion of the strategy
actor
public CMethodSet lookupJMLMethodName(String name,
CContextType context)
throws UnpositionedError
UnpositionedErrorpublic JmlSourceMethod lookupRefinedMethod(CMethod specMethod)
specMethod - the method that is doing the specializing
specMethod,
or null if it does not refine a method declared in
a type refined by this type.
UnpositionedError - -- should not happenpublic JmlSourceField lookupRefinedField(CField specField)
specField - the refining field
specField,
or null if it does not refine a field declared in
a type refined by this type. public JmlSourceClass lookupRefinedInnerType(CClass specType)
specType - the refining inner type
specType,
or null if it does not refine an inner type declared in
a type refined by this type. protected CClass getDeclaredInnerType(String name)
private void accumMethodsJMLOnly(CClass.NoDupStrategy actor,
String name,
CMethodSet accum)
name declared in the type represented by this,
ignoring external methods, using the strategy
actor. Always searches supertypes,
but only those parsed by the JML parser.
name - method nameactor - the strategy for selecting methodsaccum - a method set in which to accumulate the
results, satisfying the invariant that
all methods in accum are applicable to
the other arguments and any two distinct
methods in accum are incomparable by the
specializes relationship
UnpositionedError - at the discretion of the strategy
actor CMethodSet lookupJMLMethodsWithSameSig(CMethod specMethod)
specMethod - the method that is doing the overriding
specMethod, such that
specMethod immediately specializes
each method in the set.public JmlMemberAccess jmlAccess()
public boolean inJavaFile()
public boolean inSpecFile()
public boolean isFinishedPreProcessing()
public void setFinishedPreProcessing()
protected ClassInfo createClassInfo(long modifiers,
String superClass,
File sourceFile)
ClassInfo. This method is
overridden here to return an instnace of the class JmlClassInfo.
createClassInfo in class CClassprotected FieldInfo[] genFields()
genFields in class CClassprotected MethodInfo[] genMethods()
genMethods in class CClassprotected CClassType[] innerClassesForAttribute()
genInners.
innerClassesForAttribute in class CClass
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||