|
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.util.compiler.Phylum
org.multijava.mjc.JPhylum
org.jmlspecs.checker.JmlNode
org.jmlspecs.checker.JmlMemberDeclaration
org.jmlspecs.checker.JmlTypeDeclaration
This type represents a java class or interface in the syntax tree.
| Nested Class Summary |
| Nested classes inherited from class org.jmlspecs.checker.JmlNode |
JmlNode.DummyInitializerDeclaration |
| Fields inherited from class org.jmlspecs.checker.JmlMemberDeclaration |
refinedDecl, refiningDecl |
| Fields inherited from class org.jmlspecs.checker.JmlNode |
MJCVISIT_MESSAGE |
| Fields inherited from class org.multijava.mjc.JPhylum |
EMPTY |
| Fields inherited from class org.multijava.util.compiler.Phylum |
|
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
JmlTypeDeclaration(TokenReference where,
boolean[] interfaceWeaklyFlags,
JmlInvariant[] invariants,
JmlConstraint[] constraints,
JmlRepresentsDecl[] representsDecls,
JmlAxiom[] axioms,
JmlVarAssertion[] varAssertions,
JTypeDeclaration delegee)
|
|
| Method Summary | |
void |
accumAllTypeSignatures(ArrayList accum)
Adds the signature CSourceClass of this, and of all nested types, to accum. |
void |
addMember(JMemberDeclarationType newMember)
Adds the given member to this type's interface and modifies sourceClass to include the new member |
JmlAxiom[] |
axioms()
|
void |
cachePassParameters(CContextType context)
Caches the arguments for the compiler passes. |
void |
checkAssignableClauses()
|
private void |
checkFieldsInterface(String javaFileName)
|
private void |
checkForCycles(JmlTypeDeclaration refinedType)
Sets the refinedType field of this
JmlTypeDeclaration object. |
void |
checkInitializers()
Invokes the checkInitializers method of the implementing class using previously cached arguments. |
void |
checkInitializers(CContextType context)
Checks the static initializers created during the checkInterface pass and performs some other checks that can be performed simply before full blown typechecking. |
void |
checkInterface()
Invokes the checkInterface method of the implementing class using previously cached arguments. |
void |
checkInterface(CContextType context)
Checks the basic interfaces to make sure things generally look OK. |
private void |
checkMethodsInterface(String javaFileName)
|
private void |
checkModelFields(JFieldDeclarationType[] modelFields)
|
boolean |
checkRacability(Compiler compiler)
Checks if every method is rac-compilable. |
private JmlTypeDeclaration |
checkRedundantRepresents(JmlRepresentsDecl redundantRep,
String ident)
|
private void |
combineClassSpecs()
|
JmlAxiom[] |
combinedAxioms()
|
JmlConstraint[] |
combinedConstraints()
|
JmlInvariant[] |
combinedInvariants()
|
JmlRepresentsDecl[] |
combinedRepresentsDecls()
|
JmlVarAssertion[] |
combinedVarAssertions()
|
private void |
combineFieldAndMethodModifiersOfNestedTypes()
|
private void |
combineFieldModifiersAndSetInitializer()
|
private void |
combineFieldSpecs()
|
private void |
combineMethodModifiersAndSetBody()
|
private void |
combineMethodSpecs()
|
private void |
combineNestedClassSpecs()
|
private void |
combineParameterModifiers(JmlMethodDeclaration meth)
|
void |
combineSpecifications()
|
int |
compareTo(Object o)
Compares this to a given object. |
JmlConstraint[] |
constraints()
|
JFieldDeclarationType[] |
fields()
|
JPhylum[] |
fieldsAndInits()
Returns an array of the static and instance initializers for the type represented by this. |
JmlTypeDeclaration |
findTypeWithRepresentsFor(CField field)
Finds the applicable representsclause for a given
model field by searching through the superclass and interface
hierachies starting from the given type declaration. |
void |
generateInterface(Main compiler,
CClass owner,
CMemberHost host,
String prefix,
boolean isAnon,
boolean isMember)
Generates a CSourceClass class signature singleton
for this declaration. |
JFieldDeclarationType[] |
getAllInterfaceModelFields()
Returns all model fields inherited through the interface hierarchy. |
ArrayList |
getAllMethods()
Walks up the extends hierarchy and adds all methods to the returned ArrayList. |
JFieldDeclarationType[] |
getAllSuperClassModelFields()
Returns all model fields inherited from abstract superclasses. |
JFieldDeclarationType[] |
getCombinedFields()
|
JmlMemberDeclaration[] |
getCombinedInners()
|
JmlMemberDeclaration[] |
getCombinedMethods()
|
JmlDataGroupMemberMap |
getDataGroupMap()
Computes the data group map (if it has not already been computed) and returns it. |
JConstructorDeclarationType |
getDefaultConstructor()
|
JFieldDeclarationType[] |
getModelFields()
Computes and stores the model fields of this type into an array. |
boolean |
hasSourceInRefinement()
Returns true if this type declaration has a source file in the refinement chain. |
String |
ident()
Returns the identifier for this type declaration. |
private void |
includeAllFields()
|
private void |
includeAllMethods()
|
private void |
includeAllNestedClasses()
|
protected void |
initializeDataGroupMap()
Initializes the map from JmlSourceField, a data group,
to a JmlAssignableFieldSet, the set of fields
in that data group. |
boolean |
inJavaFile()
Returns true if this member is declared in a '.java' file. |
ArrayList |
inners()
Returns null unless overridden by a subclass. |
CClassType[] |
interfaces()
Returns the set of interfaces that this type implements or extends. |
boolean[] |
interfaceWeaklyFlags()
|
JmlInvariant[] |
invariants()
|
boolean |
isAtTopLevel()
|
abstract boolean |
isClass()
Returns true if this is a class declaration. |
boolean |
isFinal()
Returns true if this type declaration is for a final type. |
boolean |
isInterface()
Returns true if this is an interface declaration. |
JmlMemberAccess |
jmlAccess()
|
private void |
linkFieldRefinements()
Links the fields in a refinement chain of this JmlTypeDeclaration object. |
private void |
linkInnerTypeRefinements()
Links the inner types of a refinement chain of this JmlTypeDeclaration object. |
private void |
linkMethodRefinements()
Links the methods in a refinement chain of this JmlTypeDeclaration object. |
ArrayList |
methods()
|
long |
modifiers()
|
CClass |
owner()
Returns the logical owner of this type. |
void |
preprocessDependencies()
Performs preliminary processing on compilation units and types. |
void |
preprocessDependencies(CContextType context)
Performs preliminary processing on compilation units and types. |
JmlRepresentsDecl[] |
representsDecls()
|
void |
resolveSpecializers()
Resolves value specializer expressions to the compile-time constants they represent. |
abstract void |
resolveSpecializers(CContextType context)
Computes the values of specializer expressions used to dispatch on compile-time constants. |
void |
resolveTopMethods()
Finds the top method of every declared method. |
void |
setDefaultConstructor(JConstructorDeclarationType defaultConstructor)
|
void |
setFields(JPhylum[] fields)
|
void |
setFieldsOnly(JFieldDeclarationType[] fields)
|
void |
setHasSourceInRefinement(boolean flag)
Sets that if this type declaration has a source file in the refinement chain. |
void |
setIdent(String ident)
|
void |
setInners(ArrayList v)
|
void |
setMembersToCombinedMembers()
|
void |
setMethods(ArrayList m)
|
void |
setRefinedType(JmlBinaryType refinedType)
Registers that the given type declaration, refinedType,
is refined by this type declaration. |
void |
setRefinedType(JmlTypeDeclaration refinedType)
Registers that the given type declaration, refinedType,
is refined by this type declaration. |
private void |
setRefiningType(JmlTypeDeclaration refiningDecl)
|
void |
setStatic()
Marks this type as static. |
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. |
void |
translateMJ()
Invokes the translateMJ method of the implementing class using previously cached arguments. |
void |
translateMJ(CContextType context)
Refactors this to include dispatchers for multimethods and other code necessary for running MultiJava code on a standard JVM. |
void |
typecheck()
Invokes the typecheck method of the implementing class using previously cached arguments. |
void |
typecheck(CContextType context)
Typechecks this type declaration in the context in which it appears. |
private void |
typecheckSuperTypes()
|
CTypeVariable[] |
typevariables()
|
void |
unsetStatic()
Marks this type as non-static. |
JmlVarAssertion[] |
varAssertions()
|
| Methods inherited from class org.jmlspecs.checker.JmlMemberDeclaration |
accept, checkRefinedModifiers, findJavaFileInRefinement, genComments, getCClass, getCombinedSpecification, getCombinedVarAssertions, getField, getMethod, getMostRefined, getRefinedMember, getRefiningMember, inBinaryClassFile, isDeprecated, isRefined, isRefiningMember, javadocComment, setRefinedMember, setRefiningMember, stringRepresentation |
| Methods inherited from class org.jmlspecs.checker.JmlNode |
enterSpecScope, enterSpecScope, exitSpecScope, exitSpecScope, privacy, privacyString |
| Methods inherited from class org.multijava.mjc.JPhylum |
check, check, check, check, fail, fail, fail, warn, warn, warn, warn |
| Methods inherited from class org.multijava.util.compiler.Phylum |
getTokenReference, setTokenReference |
| 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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.multijava.mjc.JTypeDeclarationType |
createContext |
| Methods inherited from interface org.multijava.mjc.JMemberDeclarationType |
accept, genComments, getCClass, getField, getMethod, isDeprecated |
| Methods inherited from interface org.multijava.util.compiler.PhylumType |
getTokenReference, setTokenReference |
| Methods inherited from interface org.multijava.javadoc.Annotatable |
javadocComment |
| Methods inherited from interface org.multijava.mjc.CompilerPassEnterable |
accept, getTokenReference |
| Field Detail |
private CContextType cachedContext
private JTypeDeclaration delegee
private JmlMemberAccess jmlAccess
protected boolean[] interfaceWeaklyFlags
protected JmlInvariant[] invariants
protected JmlConstraint[] constraints
protected JmlRepresentsDecl[] representsDecls
protected JmlAxiom[] axioms
protected JmlVarAssertion[] varAssertions
protected JmlInvariant[] combinedInvariants
protected JmlConstraint[] combinedConstraints
protected JmlRepresentsDecl[] combinedRepresentsDecls
protected JmlAxiom[] combinedAxioms
protected JmlVarAssertion[] combinedVarAssertions
private JFieldDeclarationType[] combinedFields
protected ArrayList methodList
protected JmlMemberDeclaration[] combinedMethods
protected ArrayList innerList
protected JmlMemberDeclaration[] combinedInners
protected JFieldDeclarationType[] modelFields
protected JFieldDeclarationType[] superClassModelFields
protected JFieldDeclarationType[] interfaceModelFields
protected JmlDataGroupMemberMap dataGroupMap
private boolean hasSourceInRefinement
protected boolean hasBeenCombinedWithRefinedDecl
| Constructor Detail |
public JmlTypeDeclaration(TokenReference where,
boolean[] interfaceWeaklyFlags,
JmlInvariant[] invariants,
JmlConstraint[] constraints,
JmlRepresentsDecl[] representsDecls,
JmlAxiom[] axioms,
JmlVarAssertion[] varAssertions,
JTypeDeclaration delegee)
| Method Detail |
public void generateInterface(Main compiler,
CClass owner,
CMemberHost host,
String prefix,
boolean isAnon,
boolean isMember)
CSourceClass class signature singleton
for this declaration.
generateInterface in interface JTypeDeclarationTypecompiler - the compiler instance for which this singleton is
generatedowner - the class signature singleton for the logical outer
class of this, or null if this is a top level
declarationhost - the signature singleton of the context in which this
is declared, a CCompilationUnit for
top-level declarationsprefix - the prefix prepended to this declaration's
identifier to achieve the fully qualified
name, just the package name (using '/'
separators) for top-level classes, package
name plus $-delimited outer class names plus
synthetic index for inner classesisAnon - true if this is an anonymous class, in which
case the fully qualified name is just
prefix isMember - true if this is a member type, i.e., a nested type
that is not a local type or an anonymous classpublic boolean[] interfaceWeaklyFlags()
public JmlInvariant[] invariants()
public JmlConstraint[] constraints()
public JmlRepresentsDecl[] representsDecls()
public JmlAxiom[] axioms()
public JmlVarAssertion[] varAssertions()
public JmlInvariant[] combinedInvariants()
public JmlConstraint[] combinedConstraints()
public JmlRepresentsDecl[] combinedRepresentsDecls()
public JmlAxiom[] combinedAxioms()
public JmlVarAssertion[] combinedVarAssertions()
public CTypeVariable[] typevariables()
public CClassType[] interfaces()
JTypeDeclarationType
interfaces in interface JTypeDeclarationTypepublic JPhylum[] fieldsAndInits()
fieldsAndInits in interface JTypeDeclarationTypepublic ArrayList methods()
methods in interface JTypeDeclarationTypepublic void setMethods(ArrayList m)
public ArrayList inners()
JmlMemberDeclaration
inners in interface JTypeDeclarationTypeinners in class JmlMemberDeclarationpublic void setInners(ArrayList v)
setInners in interface JTypeDeclarationTypepublic boolean isAtTopLevel()
isAtTopLevel in interface JTypeDeclarationTypepublic JFieldDeclarationType[] fields()
fields in interface JTypeDeclarationTypepublic JConstructorDeclarationType getDefaultConstructor()
getDefaultConstructor in interface JTypeDeclarationTypepublic void setDefaultConstructor(JConstructorDeclarationType defaultConstructor)
setDefaultConstructor in interface JTypeDeclarationTypepublic void setIdent(String ident)
setIdent in interface JTypeDeclarationTypepublic String ident()
ident in interface JTypeDeclarationTypepublic void addMember(JMemberDeclarationType newMember)
addMember in interface JTypeDeclarationTypenewMember - a member to be added to this typepublic void setFields(JPhylum[] fields)
public void setFieldsOnly(JFieldDeclarationType[] fields)
public CClass owner()
owner in interface JTypeDeclarationTypepublic long modifiers()
modifiers in interface JTypeDeclarationTypepublic void setStatic()
also requires (* this.generateInterface(...) has not been invoked *); requires_redundantly (* sourceClass == null *); ensures hasFlag(delegee.modifiers(), ACC_STATIC);
setStatic in interface JTypeDeclarationTypepublic void unsetStatic()
also ensures !hasFlag(delegee.modifiers,ACC_STATIC);
unsetStatic in interface JTypeDeclarationTypepublic void syntheticOuterThisInaccessible()
syntheticOuterThisInaccessible in interface JTypeDeclarationTypepublic void accumAllTypeSignatures(ArrayList accum)
accumAllTypeSignatures in interface JTypeDeclarationTypepublic boolean isFinal()
public abstract boolean isClass()
public boolean isInterface()
public boolean hasSourceInRefinement()
public void setHasSourceInRefinement(boolean flag)
public JmlMemberAccess jmlAccess()
public boolean inJavaFile()
inJavaFile in class JmlMemberDeclarationpublic JmlDataGroupMemberMap getDataGroupMap()
public JFieldDeclarationType[] getModelFields()
protected void initializeDataGroupMap()
JmlSourceField, a data group,
to a JmlAssignableFieldSet, the set of fields
in that data group.
public JFieldDeclarationType[] getAllSuperClassModelFields()
public JFieldDeclarationType[] getAllInterfaceModelFields()
public JmlTypeDeclaration findTypeWithRepresentsFor(CField field)
representsclause for a given
model field by searching through the superclass and interface
hierachies starting from the given type declaration. If such a
clause is found, returns the type declaration that includes the
clause; otherwise, returns null.
requires field != null && hasFlag(field.modifiers(),ACC_MODEL); ensures \result != null ==> (* \result has represents clause r such that !r.isRedundantly() && r.usesAbstractionFunction() && r.storeRef() refers to field *);
private JmlTypeDeclaration checkRedundantRepresents(JmlRepresentsDecl redundantRep,
String ident)
public ArrayList getAllMethods()
getAllMethods in interface JTypeDeclarationType
public void preprocessDependencies(CContextType context)
throws PositionedError
preprocessDependencies in interface JTypeDeclarationTypePositionedError
public void checkInterface(CContextType context)
throws PositionedError
checkInterface in interface JTypeDeclarationTypecontext - the context in which this
decl appears
PositionedError - an error with reference to
the source file
public void checkInitializers(CContextType context)
throws PositionedError
checkInitializers in interface JTypeDeclarationTypecontext - the context in which this class
declaration appears
PositionedError - if check fails
public abstract void resolveSpecializers(CContextType context)
throws PositionedError
resolveSpecializers in interface JTypeDeclarationTypecontext - the context in which this class
declaration appears
PositionedError - if the check fails
public void resolveTopMethods()
throws PositionedError
resolveTopMethods in interface JTypeDeclarationTypePositionedError
public void typecheck(CContextType context)
throws PositionedError
typecheck in interface JTypeDeclarationTypecontext - the context in which this type declaration appears
PositionedError - if any checks fail public void translateMJ(CContextType context)
translateMJ in interface JTypeDeclarationType
public int compareTo(Object o)
throws ClassCastException
also requires o instanceof JmlTypeDeclaration; ensures (* \result is ordered according to suffix of the source files *); also requires o != null && !(o instanceof JmlTypeDeclaration); signals_only ClassCastException;
compareTo in interface Comparableo - an Object value to compare to this
ClassCastException - if o is incomparable to thispublic void cachePassParameters(CContextType context)
cachePassParameters in interface JTypeDeclarationType!FIXME! this spec (or the implementation) is wrong, delegee's
state is not changed
also
ensures delegee.arePassParametersCached;
public void preprocessDependencies()
throws PositionedError
preprocessDependencies in interface CompilerPassEnterablePositionedError
public void checkInterface()
throws PositionedError
CompilerPassEnterablerequires arePassParametersCached;
checkInterface in interface CompilerPassEnterablePositionedError
public void checkInitializers()
throws PositionedError
CompilerPassEnterablerequires arePassParametersCached;
checkInitializers in interface CompilerPassEnterablePositionedError
public void resolveSpecializers()
throws PositionedError
CompilerPassEnterable
resolveSpecializers in interface CompilerPassEnterablePositionedError
public void typecheck()
throws PositionedError
CompilerPassEnterablerequires arePassParametersCached;
typecheck in interface CompilerPassEnterablePositionedErrorpublic void translateMJ()
CompilerPassEnterablerequires arePassParametersCached;
translateMJ in interface CompilerPassEnterablepublic void setRefinedType(JmlBinaryType refinedType)
refinedType,
is refined by this type declaration.
public void setRefinedType(JmlTypeDeclaration refinedType)
throws PositionedError
refinedType,
is refined by this type declaration.
PositionedError
private void checkForCycles(JmlTypeDeclaration refinedType)
throws PositionedError
refinedType field of this
JmlTypeDeclaration object.
Throws an exception if setting this field would have created
a cycle in the refinement sequence.
PositionedErrorprivate void setRefiningType(JmlTypeDeclaration refiningDecl)
private void checkFieldsInterface(String javaFileName)
private void checkModelFields(JFieldDeclarationType[] modelFields)
private void typecheckSuperTypes()
private void checkMethodsInterface(String javaFileName)
public void checkAssignableClauses()
throws PositionedError
PositionedErrorpublic JFieldDeclarationType[] getCombinedFields()
public JmlMemberDeclaration[] getCombinedMethods()
public JmlMemberDeclaration[] getCombinedInners()
public void setMembersToCombinedMembers()
private void combineFieldModifiersAndSetInitializer()
private void combineMethodModifiersAndSetBody()
private void combineParameterModifiers(JmlMethodDeclaration meth)
private void combineFieldAndMethodModifiersOfNestedTypes()
public void combineSpecifications()
JmlMemberDeclaration
private void linkFieldRefinements()
JmlTypeDeclaration object.
private void linkMethodRefinements()
JmlTypeDeclaration object.
private void linkInnerTypeRefinements()
throws PositionedError
JmlTypeDeclaration object.
PositionedErrorprivate void combineMethodSpecs()
private void includeAllMethods()
private void combineFieldSpecs()
private void includeAllFields()
private void combineNestedClassSpecs()
private void includeAllNestedClasses()
private void combineClassSpecs()
public boolean checkRacability(Compiler compiler)
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||