Class DefaultCompilerAdapter
java.lang.Object
org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter
- All Implemented Interfaces:
- CompilerAdapter,- CompilerAdapterExtension
public abstract class DefaultCompilerAdapter
extends Object
implements CompilerAdapter, CompilerAdapterExtension
This is the default implementation for the CompilerAdapter interface.
 Currently, this is a cut-and-paste of the original javac task.
- Since:
- Ant 1.3
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected Javacprotected Pathprotected Pathprotected File[]protected Pathprotected booleanprotected booleanprotected booleanprotected Fileprotected Stringprotected Pathprotected booleanprotected booleanprotected Locationprotected static final StringDeprecated.protected Stringprotected Stringprotected Pathprotected Pathprotected booleanprotected Projectprotected Stringprotected Pathprotected Stringprotected Pathprotected boolean
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidAdds the command line arguments specific to the current implementation.protected voidaddExtdirsToClasspath(Path classpath) Deprecated.since 1.5.x.protected booleanShall we assume JDK 1.1+ command line switches?protected booleanShall we assume JDK 1.2+ command line switches?protected booleanShall we assume JDK 1.3+ command line switches?protected booleanShall we assume JDK 1.4+ command line switches?protected booleanShall we assume JDK 1.5+ command line switches?protected booleanShall we assume JDK 1.6+ command line switches?protected booleanShall we assume JDK 1.7+ command line switches?protected booleanShall we assume JDK 1.8+ command line switches?protected booleanShall we assume JDK 10+ command line switches?protected booleanDeprecated.since Ant 1.10.7, use assumeJava1_1Plus, if necessary combined with !assumeJava1_2Plusprotected booleanDeprecated.since Ant 1.10.7, use assumeJava1_2Plus, if necessary combined with !assumeJava1_3Plusprotected booleanDeprecated.since Ant 1.10.7, use assumeJava1_3Plus, if necessary combined with !assumeJava1_4Plusprotected booleanDeprecated.since Ant 1.10.7, use assumeJava1_4Plus, if necessary combined with !assumeJava1_5Plusprotected booleanDeprecated.since Ant 1.10.7, use assumeJava1_5Plus, if necessary combined with !assumeJava1_6Plusprotected booleanDeprecated.since Ant 1.10.7, use assumeJava1_6Plus, if necessary combined with !assumeJava1_7Plusprotected booleanDeprecated.since Ant 1.10.7, use assumeJava1_7Plus, if necessary combined with !assumeJava1_8Plusprotected booleanDeprecated.since Ant 1.10.7, use assumeJava1_8Plus, if necessary combined with !assumeJava9Plusprotected booleanDeprecated.use #assumeJava9 insteadprotected booleanDeprecated.since Ant 1.10.7, use assumeJava9Plus, in the future if necessary combined with !assumeJava10Plusprotected booleanShall we assume JDK 9+ command line switches?protected intexecuteExternalCompile(String[] args, int firstFileName) Do the compile with the specified arguments.protected intexecuteExternalCompile(String[] args, int firstFileName, boolean quoteFiles) Do the compile with the specified arguments.protected PathCombines a user specified bootclasspath with the system bootclasspath taking build.sysclasspath into account.protected PathBuilds the compilation classpath.getJavac()Get the Javac task instance associated with this compiler adapterprotected PathBuilds the modulepath.protected PathBuilds the modulesourcepath for multi module compilation.protected StringThe argument the compiler wants to see if the debug attribute has been set to false.protected ProjectGet the project this compiler adapter was created in.String[]By default, only recognize files with a Java extension, but specialized compilers can recognize multiple kinds of files.protected PathBuilds the upgrademodulepath.protected voidLogs the compilation parameters, adds the files to compile and logs the "niceSourceList"voidSet the Javac instance which contains the configured compilation attributes.protected CommandlineSet up the command line.protected CommandlinesetupJavacCommand(boolean debugLevelCheck) Does the command line argument processing for classic and adds the files to compile as well.protected CommandlineGet the command line arguments for the switches.protected CommandlinesetupJavacCommandlineSwitches(Commandline cmd, boolean useDebugLevel) Does the command line argument processing common to classic and modern.protected CommandlineDoes the command line argument processing for modern and adds the files to compile as well.protected CommandlineDoes the command line argument processing for modern.Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.tools.ant.taskdefs.compilers.CompilerAdapterexecute
- 
Field Details- 
lSepDeprecated.
- 
src
- 
destDir
- 
encoding
- 
debugprotected boolean debug
- 
optimizeprotected boolean optimize
- 
deprecationprotected boolean deprecation
- 
dependprotected boolean depend
- 
verboseprotected boolean verbose
- 
target
- 
release
- 
bootclasspath
- 
extdirs
- 
compileClasspath
- 
modulepath
- 
upgrademodulepath
- 
compileSourcepath
- 
moduleSourcepath
- 
project
- 
location
- 
includeAntRuntimeprotected boolean includeAntRuntime
- 
includeJavaRuntimeprotected boolean includeJavaRuntime
- 
memoryInitialSize
- 
memoryMaximumSize
- 
compileList
- 
attributes
 
- 
- 
Constructor Details- 
DefaultCompilerAdapterpublic DefaultCompilerAdapter()
 
- 
- 
Method Details- 
setJavacSet the Javac instance which contains the configured compilation attributes.- Specified by:
- setJavacin interface- CompilerAdapter
- Parameters:
- attributes- a configured Javac task.
 
- 
getJavacGet the Javac task instance associated with this compiler adapter- Returns:
- the configured Javac task instance used by this adapter.
 
- 
getSupportedFileExtensionsBy default, only recognize files with a Java extension, but specialized compilers can recognize multiple kinds of files.- Specified by:
- getSupportedFileExtensionsin interface- CompilerAdapterExtension
- Returns:
- list of source file extensions recognized by this compiler adapter.
 
- 
getProjectGet the project this compiler adapter was created in.- Returns:
- the owner project
- Since:
- Ant 1.6
 
- 
getCompileClasspathBuilds the compilation classpath.- Returns:
- the compilation class path
 
- 
getModulepath
- 
getUpgrademodulepathBuilds the upgrademodulepath.- Returns:
- the upgrademodulepath
- Since:
- 1.9.7
 
- 
getModulesourcepathBuilds the modulesourcepath for multi module compilation.- Returns:
- the modulesourcepath
- Since:
- 1.9.7
 
- 
setupJavacCommandlineSwitchesGet the command line arguments for the switches.- Parameters:
- cmd- the command line
- Returns:
- the command line
 
- 
setupJavacCommandlineSwitchesDoes the command line argument processing common to classic and modern. Doesn't add the files to compile.- Parameters:
- cmd- the command line
- useDebugLevel- if true set set the debug level with the -g switch
- Returns:
- the command line
 
- 
setupModernJavacCommandlineSwitchesDoes the command line argument processing for modern. Doesn't add the files to compile.- Parameters:
- cmd- the command line
- Returns:
- the command line
 
- 
setupModernJavacCommandDoes the command line argument processing for modern and adds the files to compile as well.- Returns:
- the command line
 
- 
setupJavacCommand
- 
setupJavacCommandDoes the command line argument processing for classic and adds the files to compile as well.- Parameters:
- debugLevelCheck- if true set the debug level with the -g switch
- Returns:
- the command line
 
- 
logAndAddFilesToCompileLogs the compilation parameters, adds the files to compile and logs the "niceSourceList"- Parameters:
- cmd- the command line
 
- 
executeExternalCompileDo the compile with the specified arguments.- Parameters:
- args- - arguments to pass to process on command line
- firstFileName- - index of the first source file in args, if the index is negative, no temporary file will ever be created, but this may hit the command line length limit on your system.
- Returns:
- the exit code of the compilation
 
- 
executeExternalCompileDo the compile with the specified arguments.The working directory if the executed process will be the project's base directory. - Parameters:
- args- - arguments to pass to process on command line
- firstFileName- - index of the first source file in args, if the index is negative, no temporary file will ever be created, but this may hit the command line length limit on your system.
- quoteFiles- - if set to true, filenames containing spaces will be quoted when they appear in the external file. This is necessary when running JDK 1.4's javac and probably others.
- Returns:
- the exit code of the compilation
- Since:
- Ant 1.6
 
- 
addExtdirsToClasspathDeprecated.since 1.5.x. Use org.apache.tools.ant.types.Path#addExtdirs instead.Add extdirs to classpath- Parameters:
- classpath- the classpath to use
 
- 
addCurrentCompilerArgsAdds the command line arguments specific to the current implementation.- Parameters:
- cmd- the command line to use
 
- 
assumeJava11Deprecated.since Ant 1.10.7, use assumeJava1_1Plus, if necessary combined with !assumeJava1_2PlusShall we assume JDK 1.1 command line switches?- Returns:
- true if jdk 1.1
- Since:
- Ant 1.5
 
- 
assumeJava1_1Plusprotected boolean assumeJava1_1Plus()Shall we assume JDK 1.1+ command line switches?- Returns:
- true if jdk 1.1 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava12Deprecated.since Ant 1.10.7, use assumeJava1_2Plus, if necessary combined with !assumeJava1_3PlusShall we assume JDK 1.2 command line switches?- Returns:
- true if jdk 1.2
- Since:
- Ant 1.5
 
- 
assumeJava1_2Plusprotected boolean assumeJava1_2Plus()Shall we assume JDK 1.2+ command line switches?- Returns:
- true if jdk 1.2 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava13Deprecated.since Ant 1.10.7, use assumeJava1_3Plus, if necessary combined with !assumeJava1_4PlusShall we assume JDK 1.3 command line switches?- Returns:
- true if jdk 1.3
- Since:
- Ant 1.5
 
- 
assumeJava1_3Plusprotected boolean assumeJava1_3Plus()Shall we assume JDK 1.3+ command line switches?- Returns:
- true if jdk 1.3 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava14Deprecated.since Ant 1.10.7, use assumeJava1_4Plus, if necessary combined with !assumeJava1_5PlusShall we assume JDK 1.4 command line switches?- Returns:
- true if jdk 1.4
- Since:
- Ant 1.6.3
 
- 
assumeJava1_4Plusprotected boolean assumeJava1_4Plus()Shall we assume JDK 1.4+ command line switches?- Returns:
- true if jdk 1.4 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava15Deprecated.since Ant 1.10.7, use assumeJava1_5Plus, if necessary combined with !assumeJava1_6PlusShall we assume JDK 1.5 command line switches?- Returns:
- true if JDK 1.5
- Since:
- Ant 1.6.3
 
- 
assumeJava1_5Plusprotected boolean assumeJava1_5Plus()Shall we assume JDK 1.5+ command line switches?- Returns:
- true if jdk 1.5 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava16Deprecated.since Ant 1.10.7, use assumeJava1_6Plus, if necessary combined with !assumeJava1_7PlusShall we assume JDK 1.6 command line switches?- Returns:
- true if JDK 1.6
- Since:
- Ant 1.7
 
- 
assumeJava1_6Plusprotected boolean assumeJava1_6Plus()Shall we assume JDK 1.6+ command line switches?- Returns:
- true if jdk 1.6 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava17Deprecated.since Ant 1.10.7, use assumeJava1_7Plus, if necessary combined with !assumeJava1_8PlusShall we assume JDK 1.7 command line switches?- Returns:
- true if JDK 1.7
- Since:
- Ant 1.8.2
 
- 
assumeJava1_7Plusprotected boolean assumeJava1_7Plus()Shall we assume JDK 1.7+ command line switches?- Returns:
- true if jdk 1.7 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava18Deprecated.since Ant 1.10.7, use assumeJava1_8Plus, if necessary combined with !assumeJava9PlusShall we assume JDK 1.8 command line switches?- Returns:
- true if JDK 1.8
- Since:
- Ant 1.8.3
 
- 
assumeJava1_8Plusprotected boolean assumeJava1_8Plus()Shall we assume JDK 1.8+ command line switches?- Returns:
- true if jdk 1.8 and above
- Since:
- Ant 1.10.7
 
- 
assumeJava19Deprecated.use #assumeJava9 insteadShall we assume JDK 9 command line switches?- Returns:
- true if JDK 9
- Since:
- Ant 1.9.4
 
- 
assumeJava9Deprecated.since Ant 1.10.7, use assumeJava9Plus, in the future if necessary combined with !assumeJava10PlusShall we assume JDK 9 command line switches?- Returns:
- true if JDK 9
- Since:
- Ant 1.9.8
 
- 
assumeJava9Plusprotected boolean assumeJava9Plus()Shall we assume JDK 9+ command line switches?- Returns:
- true if JDK 9+
- Since:
- Ant 1.10.2
 
- 
assumeJava10Plusprotected boolean assumeJava10Plus()Shall we assume JDK 10+ command line switches?- Returns:
- true if JDK 10+
- Since:
- Ant 1.10.7
 
- 
getBootClassPathCombines a user specified bootclasspath with the system bootclasspath taking build.sysclasspath into account.- Returns:
- a non-null Path instance that combines the user specified and the system bootclasspath.
 
- 
getNoDebugArgumentThe argument the compiler wants to see if the debug attribute has been set to false.A return value of nullmeans no argument at all.- Returns:
- "-g:none" unless we expect to invoke a JDK 1.1 compiler.
- Since:
- Ant 1.6.3
 
 
-