|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rice.cs.drjava.model.compiler.JavacCompiler
public abstract class JavacCompiler
An abstract parent for all javac-based compiler interfaces. Manages the auxiliary naming methods. To support loading via reflection, all subclasses are assumed to have a public constructor with a matching signature.
| Field Summary | |
|---|---|
protected java.util.List<? extends java.io.File> |
_defaultBootClassPath
|
protected java.lang.String |
_location
|
protected JavaVersion.FullVersion |
_version
|
protected static java.util.Set<java.lang.String> |
ACM_PROGRAM_CLASSES
The set of class names that are run as ACM Java Task Force library programs. |
static java.util.HashSet<java.lang.String> |
JAVA_KEYWORDS
Set of Java/GJ keywords for special coloring. |
| Constructor Summary | |
|---|---|
protected |
JavacCompiler(JavaVersion.FullVersion version,
java.lang.String location,
java.util.List<? extends java.io.File> defaultBootClassPath)
|
| Method Summary | |
|---|---|
protected static java.lang.String |
_deleteSemiColon(java.lang.String s)
Deletes the last character of a string. |
protected static java.lang.String |
_transformCommand(java.lang.String s,
java.lang.String command)
Assumes a trimmed String. |
java.util.List<java.io.File> |
additionalBootClassPathForInteractions()
A compiler can instruct DrJava to include additional elements for the boot class path of the Interactions JVM. |
abstract java.util.List<? extends DJError> |
compile(java.util.List<? extends java.io.File> files,
java.util.List<? extends java.io.File> classPath,
java.util.List<? extends java.io.File> sourcePath,
java.io.File destination,
java.util.List<? extends java.io.File> bootClassPath,
java.lang.String sourceVersion,
boolean showWarnings)
Compile the given files. |
java.lang.String |
getDescription()
Returns a one-line description of the compiler (such as the name and file location) |
javax.swing.filechooser.FileFilter |
getFileFilter()
Return a file filter that can be used to open files this compiler supports. |
java.util.Set<java.lang.String> |
getKeywordsForFile(java.io.File f)
Return the set of keywords that should be highlighted in the specified file. |
java.lang.String |
getName()
Returns the name of this compiler, appropriate to show to the user. |
java.lang.String |
getOpenAllFilesInFolderExtension()
Return the extension of the files that should be opened with the "Open Folder..." command. |
java.util.Set<java.lang.String> |
getSourceFileExtensions()
Return the set of source file extensions that this compiler supports. |
java.lang.String |
getSuggestedFileExtension()
Return the suggested file extension that will be appended to a file without extension. |
abstract boolean |
isAvailable()
Indicates whether this compiler is actually available. |
boolean |
isSourceFileForThisCompiler(java.io.File f)
.java --> true .dj --> true .dj0 --> true .dj1 --> true .dj2 --> true otherwise false |
static void |
runCommand(java.lang.String s,
java.lang.Class<?> c)
This method performs the "smart run". |
boolean |
supportsLanguageLevels()
Return true if this compiler can be used in conjunction with the language level facility. |
java.lang.String |
toString()
String to display in a combo box (generally getName()) |
static java.lang.String |
transformAppletCommand(java.lang.String s)
|
java.lang.String |
transformCommands(java.lang.String interactionsString)
Transform the command line to be interpreted into something the Interactions JVM can use. |
static java.lang.String |
transformJavaCommand(java.lang.String s)
|
static java.lang.String |
transformRunCommand(java.lang.String s)
|
JavaVersion |
version()
The latest version of Java supported by the compiler |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final JavaVersion.FullVersion _version
protected final java.lang.String _location
protected java.util.List<? extends java.io.File> _defaultBootClassPath
protected static final java.util.Set<java.lang.String> ACM_PROGRAM_CLASSES
public static final java.util.HashSet<java.lang.String> JAVA_KEYWORDS
| Constructor Detail |
|---|
protected JavacCompiler(JavaVersion.FullVersion version,
java.lang.String location,
java.util.List<? extends java.io.File> defaultBootClassPath)
| Method Detail |
|---|
public abstract boolean isAvailable()
CompilerInterfaceCompilerInterface.compile(java.util.List extends java.io.File>, java.util.List extends java.io.File>, java.util.List extends java.io.File>, java.io.File, java.util.List extends java.io.File>, java.lang.String, boolean) method should not fail due to class not being found.
isAvailable in interface CompilerInterface
public abstract java.util.List<? extends DJError> compile(java.util.List<? extends java.io.File> files,
java.util.List<? extends java.io.File> classPath,
java.util.List<? extends java.io.File> sourcePath,
java.io.File destination,
java.util.List<? extends java.io.File> bootClassPath,
java.lang.String sourceVersion,
boolean showWarnings)
CompilerInterface
compile in interface CompilerInterfacefiles - Source files to compile.classPath - Support jars or directories that should be on the classpath. If null, the default is used.sourcePath - Location of additional sources to be compiled on-demand. If null, the default is used.destination - Location (directory) for compiled classes. If null, the default in-place location is used.bootClassPath - The bootclasspath (contains Java API jars or directories); should be consistent with
sourceVersion
If null, the default is used.sourceVersion - The language version of the sources. Should be consistent with bootClassPath.
If null, the default is used.showWarnings - Whether compiler warnings should be shown or ignored.
public JavaVersion version()
CompilerInterface
version in interface CompilerInterfacepublic java.lang.String getName()
CompilerInterface
getName in interface CompilerInterfacepublic java.lang.String getDescription()
CompilerInterface
getDescription in interface CompilerInterfacepublic java.lang.String toString()
CompilerInterfacegetName())
toString in interface CompilerInterfacetoString in class java.lang.Objectpublic java.util.List<java.io.File> additionalBootClassPathForInteractions()
additionalBootClassPathForInteractions in interface CompilerInterfacepublic java.lang.String transformCommands(java.lang.String interactionsString)
transformCommands in interface CompilerInterfaceinteractionsString - unprocessed command line
public static java.lang.String transformJavaCommand(java.lang.String s)
public static java.lang.String transformAppletCommand(java.lang.String s)
public static void runCommand(java.lang.String s,
java.lang.Class<?> c)
throws java.lang.Throwable
s - full command line, i.e. "run MyClass 1 2 3"c - class to be run, i.e. MyClass.class
java.lang.Throwablepublic static java.lang.String transformRunCommand(java.lang.String s)
protected static java.lang.String _transformCommand(java.lang.String s,
java.lang.String command)
MessageFormat. That means that certain characters,
single quotes and curly braces, for example, are special. To write single quotes, you need to double them.
To write curly braces, you need to enclose them in single quotes. Example:
MessageFormat.format("Abc {0} ''foo'' '{'something'}'", "def") returns "Abc def 'foo' {something}".
s - the command line, either "java MyApp arg1 arg2 arg3" or "applet MyApplet arg1 arg2 arg3"command - the command to execute, with {0} marking the place for the class name and {1} the place for the argumentsprotected static java.lang.String _deleteSemiColon(java.lang.String s)
s - the String containing the semicolon
public boolean isSourceFileForThisCompiler(java.io.File f)
isSourceFileForThisCompiler in interface CompilerInterfacef - file to check if it is a source file
public java.util.Set<java.lang.String> getSourceFileExtensions()
getSourceFileExtensions in interface CompilerInterfacepublic java.lang.String getSuggestedFileExtension()
getSuggestedFileExtension in interface CompilerInterfacepublic javax.swing.filechooser.FileFilter getFileFilter()
getFileFilter in interface CompilerInterfacepublic java.lang.String getOpenAllFilesInFolderExtension()
getOpenAllFilesInFolderExtension in interface CompilerInterfacepublic boolean supportsLanguageLevels()
supportsLanguageLevels in interface CompilerInterfacepublic java.util.Set<java.lang.String> getKeywordsForFile(java.io.File f)
getKeywordsForFile in interface CompilerInterfacef - file for which to return the keywords
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||