|
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.JmlCompilationUnit
This class represents a single JML compilation unit (typically a file in a file-based compiler like this) in the AST. The production for a compilation unit is the main entry point in JML parser grammar.
| Nested Class Summary |
| Nested classes inherited from class org.jmlspecs.checker.JmlNode |
JmlNode.DummyInitializerDeclaration |
| Field Summary | |
private Main |
cachedCompiler
|
private JTypeDeclarationType[] |
combinedTypeDeclarations
|
private JCompilationUnit |
delegee
The MultiJava compilation unit decorated by this JML class. |
private boolean |
finishedSymTab
|
private boolean |
finishedTypeCheck
|
static JPackageImportType |
JMLSPECS_LANG
|
protected int |
levelNumber
See JmlSourceClass for an explanation of
the levelNumber field |
private boolean |
refined
True if this compilation unit is refined by another compilation unit. |
private JmlRefinePrefix |
refinePrefix
|
private JmlCompilationUnit |
refiningCUnit
|
private Main.Task |
task
|
| Fields inherited from class org.jmlspecs.checker.JmlNode |
MJCVISIT_MESSAGE |
| 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 |
| 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 | |
JmlCompilationUnit(TokenReference where,
JPackageName packageName,
CCompilationUnit export,
JPackageImportType[] importedPackages,
ArrayList importedUnits,
JTypeDeclarationType[] typeDeclarations,
ArrayList tlMethods,
JmlRefinePrefix refinePrefix)
Constructs a CompilationUnit with the specified top level context |
|
| Method Summary | |
void |
accept(MjcVisitor p)
Accepts the specified visitor. |
void |
acceptDelegee(MjcVisitor p)
|
CSourceClass[] |
allTypeSignatures()
Returns the CSourceClass objects representing the type signatures of the types declared in this compilatoin unit and as nested types. |
void |
cachePassParameters(Main compiler,
Destination destination)
Caches the arguments for the compiler passes. |
void |
checkAssignableClauses()
|
void |
checkInitializers()
Invokes the checkInitializers method of the implementing class using previously cached arguments. |
void |
checkInitializers(Main compiler)
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(Main compiler)
Checks the basic interfaces to make sure things generally look OK. |
JTypeDeclarationType[] |
combinedTypeDeclarations()
|
void |
combineSpecifications()
|
int |
compareTo(Object o)
Compares this to a given object. |
boolean |
declaresGF(String qualifiedName)
Returns true iff this compilation unit contains a declaration for a generic function with the given fully qualified name. |
boolean |
declaresType(String qualifiedName)
Returns true iff this compilation unit contains a declaration for a top-level type with the given fully qualified name. |
File |
file()
Returns the file associated with this compilation unit. |
String |
fileNameIdent()
Returns the Java identifier associated with the name of the file containing this compilation unit. |
String |
getFilePath()
|
Main.Task |
getSuspendedTask()
|
MJGenericFunctionDecl[] |
gfDeclarations()
|
boolean |
hasSourceInRefinement()
Returns true if this compilation unit has a Java source file in the refinement chain. |
JClassOrGFImportType[] |
importedClasses()
|
JClassOrGFImportType[] |
importedGFs()
|
JPackageImportType[] |
importedPackages()
|
JClassOrGFImportType[] |
importedUnits()
Returns an array of the class and generic function imports for this compilation unit. |
boolean |
isRefined()
Returns true if this compilation is refined by another compilation unit. |
boolean |
isSymbolTableFinished()
Returns true if this compilation unit has finished the checkInitializers phase. |
boolean |
isTypeCheckFinished()
Returns true if this compilation unit has finished the typecheck phase. |
JPackageName |
packageName()
|
String |
packageNameAsString()
|
void |
preprocessDependencies()
Performs preliminary processing on compilation units and types. |
void |
preprocessDependencies(Main compiler)
Performs preliminary processing on compilation units and types. |
JmlCompilationUnit |
refinedCUnit()
|
JmlRefinePrefix |
refinePrefix()
|
JmlCompilationUnit |
refiningCUnit()
|
void |
resolveSpecializers()
Resolves value specializer expressions to the compile-time constants they represent. |
(package private) void |
resolveSpecializers(Main compiler)
Resolves value specializer expressions to the compile-time constants they represent. |
void |
resolveTopMethods()
Finds the top method of every declared method. |
void |
setImportedPackages(JPackageImportType[] packages)
|
void |
setPackage(JPackageName packageName)
|
void |
setRefined()
Sets that this compilation is refined by another compilation unit. |
void |
setRefiningCUnit(JmlCompilationUnit refiningCUnit)
|
void |
setSuspendedTask(Main.Task task)
|
ArrayList |
tlMethods()
Returns the AST subtrees for the augmenting method declarations. |
void |
translateMJ()
Invokes the translateMJ method of the implementing class using previously cached arguments. |
void |
translateMJ(Main compiler)
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(Main compiler)
Typechecks this compilation unit. |
JTypeDeclarationType[] |
typeDeclarations()
|
| 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.CompilerPassEnterable |
getTokenReference |
| Field Detail |
public static final JPackageImportType JMLSPECS_LANG
private Main cachedCompiler
private JCompilationUnit delegee
private JmlRefinePrefix refinePrefix
private JTypeDeclarationType[] combinedTypeDeclarations
protected int levelNumber
JmlSourceClass for an explanation of
the levelNumber field
private boolean refined
private boolean finishedSymTab
private boolean finishedTypeCheck
private JmlCompilationUnit refiningCUnit
private Main.Task task
| Constructor Detail |
public JmlCompilationUnit(TokenReference where,
JPackageName packageName,
CCompilationUnit export,
JPackageImportType[] importedPackages,
ArrayList importedUnits,
JTypeDeclarationType[] typeDeclarations,
ArrayList tlMethods,
JmlRefinePrefix refinePrefix)
where - the position of this tokenpackageName - the package to which this c.u. belongsimportedPackages - the packages imported by this c.u.importedUnits - the classes and external members imported by
this compilation unittypeDeclarations - the classes and interfaces declared
in this c.u.tlMethods - the MultiJava top-level declarations
in this c.u.refinePrefix - the refine-prefix annotation for this c.u.| Method Detail |
public String packageNameAsString()
packageNameAsString in interface JCompilationUnitTypepublic File file()
JCompilationUnitType
file in interface JCompilationUnitTypepublic String getFilePath()
public String fileNameIdent()
JCompilationUnitType
fileNameIdent in interface JCompilationUnitTypepublic JPackageName packageName()
packageName in interface JCompilationUnitTypepublic void setPackage(JPackageName packageName)
public JPackageImportType[] importedPackages()
importedPackages in interface JCompilationUnitTypepublic void setImportedPackages(JPackageImportType[] packages)
public JClassOrGFImportType[] importedClasses()
importedClasses in interface JCompilationUnitTypepublic JTypeDeclarationType[] typeDeclarations()
typeDeclarations in interface JCompilationUnitTypepublic MJGenericFunctionDecl[] gfDeclarations()
gfDeclarations in interface JCompilationUnitTypepublic CSourceClass[] allTypeSignatures()
allTypeSignatures in interface JCompilationUnitTypepublic boolean declaresType(String qualifiedName)
declaresType in interface JCompilationUnitTypequalifiedName - a fully qualified name with parts
separated by '/' not '.'public boolean declaresGF(String qualifiedName)
declaresGF in interface JCompilationUnitTypequalifiedName - a fully qualified name with parts
separated by '/' not '.'public ArrayList tlMethods()
JCompilationUnitType
tlMethods in interface JCompilationUnitTypepublic JClassOrGFImportType[] importedGFs()
importedGFs in interface JCompilationUnitTypepublic JClassOrGFImportType[] importedUnits()
JCompilationUnitType
importedUnits in interface JCompilationUnitTypepublic JmlCompilationUnit refiningCUnit()
public JmlCompilationUnit refinedCUnit()
public Main.Task getSuspendedTask()
public void setSuspendedTask(Main.Task task)
public JmlRefinePrefix refinePrefix()
public boolean isRefined()
public boolean isSymbolTableFinished()
public boolean isTypeCheckFinished()
public void setRefiningCUnit(JmlCompilationUnit refiningCUnit)
public void setRefined()
public boolean hasSourceInRefinement()
public void preprocessDependencies(Main compiler)
throws PositionedError
preprocessDependencies in interface JCompilationUnitTypePositionedError
public int compareTo(Object o)
throws ClassCastException
also requires o instanceof JmlCompilationUnit; ensures (* \result is ordered according to suffix of the source files *); also requires !(o instanceof JmlCompilationUnit); signals_only ClassCastException;
compareTo in interface Comparableo - an Object value to compare to this
ClassCastException - if o is incomparable to this
public void checkInterface(Main compiler)
throws PositionedError
JCompilationUnitType
checkInterface in interface JCompilationUnitTypePositionedError - an error with reference
to the source file
public void checkInitializers(Main compiler)
throws PositionedError
JCompilationUnitType
checkInitializers in interface JCompilationUnitTypecompiler - the compiler that is calling (passed down
through the AST via CContextType subtypes
and used for error reporting)
PositionedError - if check fails
void resolveSpecializers(Main compiler)
throws PositionedError
compiler - the compiler that is calling (passed down
through the AST via CContextType subtypes
and used for error reporting)
PositionedError
public void resolveTopMethods()
throws PositionedError
resolveTopMethods in interface JCompilationUnitTypePositionedError
public void typecheck(Main compiler)
throws PositionedError
JCompilationUnitType
typecheck in interface JCompilationUnitTypecompiler - the compiler that is calling
PositionedError - if a check fails that we cannot
recover from
public void checkAssignableClauses()
throws PositionedError
PositionedErrorpublic void translateMJ(Main compiler)
JCompilationUnitType
translateMJ in interface JCompilationUnitTypepublic void accept(MjcVisitor p)
accept in interface JCompilationUnitTypeaccept in class JmlNodep - the visitorpublic void acceptDelegee(MjcVisitor p)
public void combineSpecifications()
public JTypeDeclarationType[] combinedTypeDeclarations()
public void cachePassParameters(Main compiler,
Destination destination)
cachePassParameters in interface JCompilationUnitType
also
ensures 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
JCompilationUnitType
resolveSpecializers in interface JCompilationUnitTypePositionedError
public void typecheck()
throws PositionedError
CompilerPassEnterablerequires arePassParametersCached;
typecheck in interface CompilerPassEnterablePositionedErrorpublic void translateMJ()
CompilerPassEnterablerequires arePassParametersCached;
translateMJ in interface CompilerPassEnterable
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||