|
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.Compiler
org.multijava.mjc.Main
org.jmlspecs.checker.Main
This class implements the entry point of the JML compiler. Use
java org.jmlspecs.checker.Main --help to get usage
options.
| Nested Class Summary | |
(package private) static class |
Main.Filter
This class is used with the Directory.list method to list those files in a directory that this program is interested in processing - in this case, all those that end in '.java', '.jml' or '.spec'. |
class |
Main.JmlCheckAssignableTask
A task for checking assignable clauses; this task has to be done after type checking of assignable clauses of the super types so the fields can be combined with those of the subtype (the subtype is the one whose code is being checked against the assignable clauses but the inherited assignable clauses need to be type checked first). |
class |
Main.JmlParseTask
This class parses a group of files, given by filenames as strings, and generates a forest of ASTs. |
class |
Main.JmlTypecheckTask
This class typechecks the source code. |
(package private) static class |
Main.PTMode
|
| Nested classes inherited from class org.multijava.mjc.Main |
Main.CheckInitializerTask, Main.CheckInterfaceTask, Main.ContextBehavior, Main.DFilter, Main.ExpectedGF, Main.ExpectedIndifferent, Main.ExpectedResult, Main.ExpectedType, Main.ParseTask, Main.PreprocessTask, Main.PrettyPrintTask, Main.ResolveSpecializerTask, Main.ResolveTopMethodTask, Main.Task, Main.TaskTimes, Main.TranslateMJTask, Main.TreeProcessingTask, Main.Trees, Main.TypecheckTask |
| Field Summary | |
private HashSet |
commandLineFiles
The set of files specified on the command line to be processed during the current session. |
(package private) static Main.PTMode |
JAVA_MODE
|
(package private) static Main.PTMode |
JML_MODE
|
static JmlCommonOptions |
jmlOptions
Command-line options. |
protected HashSet |
refinedFileSequenceSet
Tracks the set of task sequence IDs for tasks spawned to process files refined by files on the main task sequence. |
(package private) static Main.PTMode |
SPEC_MODE
|
| Fields inherited from class org.multijava.util.compiler.Compiler |
PRINT_TO_ERR, PRINT_TO_OUT |
| Fields inherited from class org.multijava.util.Utils |
DBG_LEVEL_HIGH, DBG_LEVEL_LOW, DBG_LEVEL_NO |
| Constructor Summary | |
|
Main()
The principal constructor for an object to do the work of the Jml compiler. |
protected |
Main(ModifierUtility modUtil)
Construct a JML compiler (an object of Main) that
uses the given ModifierUtility. |
| Method Summary | |
protected boolean |
canStopSequenceBeforeAllPasses(Main.Task oldTask)
Returns true if it is OK to abort processing of the given task before it has been processed through all compilation passes. |
JCompilationUnitType |
catchUpRefinedFile(File file)
Parses a file and returns the AST. |
void |
catchUpTask(Main.Task task)
This version of catchUp reactivates the given task. |
void |
classToGenerate(CSourceClass clazz)
Adds a class to the list of classes to be generated in bytecode. |
static boolean |
compile(String[] args)
Second entry point. |
static boolean |
compile(String[] args,
JmlOptions opt,
OutputStream os)
Entry point for the GUI |
CCompilationUnitContextType |
createCompilationUnitContext(JCompilationUnitType jc,
CCompilationUnit cunit)
Creates a compilation unit context for this compiler. |
protected Main.Task |
createTaskAfter(Main.Task oldTask)
This method uses the dynamic type of oldTask along
with the command line options to determine what task to add to
the task queue after the given task completes. |
protected void |
exposeOptions(JmlCommonOptions opt)
Sets the static field, jmlOptions, to the given
arugment so that typechecking routines can access command-line
options. |
protected FilenameFilter |
filenameFilter()
Overridable method that provides a filter to list all the relevant files in a directory; for mjc this is all files whose names end in ".java". |
Main.ParseTask |
firstTask(File filename,
Main.ExpectedResult expected)
Generates the first task in the compilation sequence. |
Main.ParseTask |
firstTask(ArrayList infiles)
Generates the first task in the compilation sequence. |
protected WarningFilter |
getDefaultFilter()
Return an instance of the JML default warning filter. |
protected MjcCommonOptions |
getOptionsInstance(MjcCommonOptions opt)
Assigns opt to the local instance of JmlCommonOptions and returns opt as an instance of MjcCommonOptions so it can be assigned to the options variable in mjc's Main. |
protected String |
getWarningFilterNameFromOptions(MjcCommonOptions opts)
Get the warning filter's class name from the options structure. |
static boolean |
hasOptionXobspure()
|
static boolean |
hasOptionXsymr()
Returns true iff the command-line option -Xsym or
-Xsymr is specified. |
static boolean |
hasOptionXsymw()
Returns true iff the command-line option -Xsym or
-Xsymw is specified. |
static boolean |
hasUnsafeOpWarningOption()
|
protected CompilerPassEnterable[] |
includeAllRefinedCUnits(CompilerPassEnterable[] trees)
|
protected void |
initialize()
Initialize the compiler (read classpath, initialize type descriptors) |
protected void |
initSession()
Initializes the "class loader" for this compilation session. |
boolean |
isCommandLineFile(File f)
This method returns true iff the file f was specified on the command line. |
static boolean |
isSpecOrJmlMode(TokenReference t)
|
protected boolean |
jmlNoBodyOK(CContextType context)
|
static void |
main(String[] args)
The entry point when starting this program from the command line. |
protected MjcCommonOptions |
makeOptionsInstance()
This function creates an object to do the parsing of the command line arguments and to store the values of the flags and options so obtained (it does not actually do the argument parsing). |
static String |
makeRelative(String path,
String referenceDir,
String separator)
This function should return a path for the first argument that is relative to the second argument (which may be a directory or a file); if the paths are the same, an empty string is returned. |
boolean |
parseArguments(String[] args,
ArrayList infiles)
Parses the argument list. |
| Methods inherited from class org.multijava.util.compiler.Compiler |
getTimestamp, inform, inform, inform, inform, inform, inform, inform, inform, inform, modUtil, run, setOutputStream, verifyFiles, verifyFiles |
| 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 |
| Field Detail |
static final Main.PTMode JAVA_MODE
static final Main.PTMode SPEC_MODE
static final Main.PTMode JML_MODE
protected HashSet refinedFileSequenceSet
private HashSet commandLineFiles
public static JmlCommonOptions jmlOptions
invariant jmlOptions == options;
| Constructor Detail |
public Main()
protected Main(ModifierUtility modUtil)
Main) that
uses the given ModifierUtility. This constructor
allows the subclasses to have their owen version of modifier
utilities.
| Method Detail |
protected boolean jmlNoBodyOK(CContextType context)
public static void main(String[] args)
args - the command line argumentspublic static boolean compile(String[] args)
public static boolean compile(String[] args,
JmlOptions opt,
OutputStream os)
args - the file, package, and directory namesopt - the options for the toolos - the output stream for the compiler messagesprotected void initSession()
initSession in class Mainprotected MjcCommonOptions makeOptionsInstance()
makeOptionsInstance in class MainJmlOptionsprotected MjcCommonOptions getOptionsInstance(MjcCommonOptions opt)
getOptionsInstance in class Mainprotected void exposeOptions(JmlCommonOptions opt)
jmlOptions, to the given
arugment so that typechecking routines can access command-line
options.
assignable jmlOptions; ensures jmlOptions == opt;
public boolean parseArguments(String[] args,
ArrayList infiles)
parseArguments in class Main
public CCompilationUnitContextType createCompilationUnitContext(JCompilationUnitType jc,
CCompilationUnit cunit)
also requires cunit != null; ensures \result != null && contextsCreated.contains(\result);
createCompilationUnitContext in class Mainpublic static boolean isSpecOrJmlMode(TokenReference t)
public Main.ParseTask firstTask(ArrayList infiles)
also requires infiles != null && (\forall Object o; infiles.contains(o); o instanceof String);
firstTask in class Main
public Main.ParseTask firstTask(File filename,
Main.ExpectedResult expected)
firstTask in class Mainprotected String getWarningFilterNameFromOptions(MjcCommonOptions opts)
Main
getWarningFilterNameFromOptions in class Mainprotected WarningFilter getDefaultFilter()
getDefaultFilter in class Mainprotected FilenameFilter filenameFilter()
Main
filenameFilter in class Mainpublic void classToGenerate(CSourceClass clazz)
also requires clazz != null; assignable classes; ensures classes.contains(clazz);
classToGenerate in class Mainpublic boolean isCommandLineFile(File f)
public void catchUpTask(Main.Task task)
requires task != null;
public JCompilationUnitType catchUpRefinedFile(File file)
requires file != null;
protected boolean canStopSequenceBeforeAllPasses(Main.Task oldTask)
protected Main.Task createTaskAfter(Main.Task oldTask)
oldTask along
with the command line options to determine what task to add to
the task queue after the given task completes.
also requires oldTask != null && oldTask.completed; ensures \result == null || (\result.sequenceID() == oldTask.sequenceID());
createTaskAfter in class Mainprotected void initialize()
initialize in class Mainprotected CompilerPassEnterable[] includeAllRefinedCUnits(CompilerPassEnterable[] trees)
public static String makeRelative(String path,
String referenceDir,
String separator)
public static boolean hasOptionXobspure()
public static boolean hasOptionXsymr()
-Xsym or
-Xsymr is specified. This option lets the compiler
to parse external symbol table files instead of the source
files.
public static boolean hasOptionXsymw()
-Xsym or
-Xsymw is specified. This option lets the compiler
to generate external symbol table files as the compilation
result.
public static boolean hasUnsafeOpWarningOption()
|
JML | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||