Top Description Fields Constructors Methods
org.apache.tools.ant.taskdefs.compilers

public final Class CompilerAdapterFactory

extends Object
Class Inheritance
Imports
java.util.Arrays, .List, org.apache.tools.ant.BuildException, .Project, .Task, org.apache.tools.ant.types.Path, org.apache.tools.ant.util.ClasspathUtils, .JavaEnvUtils

Creates the necessary compiler adapter, given basic criteria.
Since
Ant 1.3

Field Summary

Modifier and TypeField and Description
private static final List<String>
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
private static final List<String>
private static final List<String>
private static final List<String>
private static final String
private static final List<String>

Constructor Summary

AccessConstructor and Description
private
CompilerAdapterFactory()

This is a singleton -- can't create instances!!

Method Summary

Modifier and TypeMethod and Description
private static boolean
containsIgnoreCase(final List<String> compilers, final String compilerName)

private static boolean

Returns:

true if classic os on the classpath
doesModernCompilerExist
()

query for the Modern compiler existing

public static CompilerAdapter

Returns:

the compiler adapter
getCompiler
(String
either the name of the desired compiler, or the full classname of the compiler's adapter.
compilerType
,
Task
a task to log through.
task
)

Based on the parameter passed in, this method creates the necessary factory desired.

public static CompilerAdapter

Returns:

the compiler adapter
getCompiler
(String
either the name of the desired compiler, or the full classname of the compiler's adapter.
compilerType
,
Task
a task to log through.
task
,
Path
the classpath to use when looking up an adapter class
classpath
)

Based on the parameter passed in, this method creates the necessary factory desired.

public static boolean
isClassicJdkCompiler(final String
the name of the compiler implementation
compilerName
)

Does the compiler correspond to "classic"?

public static boolean
isForkedJavac(final String
the name of the compiler implementation
compilerName
)

Is the compiler implementation a forked jdk compiler?

public static boolean
isJdkCompiler(final String
the name of the compiler implementation
compilerName
)

Is the compiler implementation a jdk compiler?

public static boolean
isJdkCompilerNickname(final String
the name of the compiler implementation
compilerName
)

Is the compiler implementation a jdk compiler without specified version?

public static boolean
isModernJdkCompiler(final String
the name of the compiler implementation
compilerName
)

Does the compiler correspond to "modern"?

private static CompilerAdapter
resolveClassName(String
The fully qualified classname to be created.
className
,
ClassLoader
the classloader to use
loader
)

Tries to resolve the given classname into a compiler adapter.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CLASSIC_JDK_COMPILERSback to summary
private static final List<String> CLASSIC_JDK_COMPILERS
COMPILER_CLASSICback to summary
public static final String COMPILER_CLASSIC
COMPILER_EXTJAVACback to summary
public static final String COMPILER_EXTJAVAC
COMPILER_EXTJAVAC_CLASSNAMEback to summary
public static final String COMPILER_EXTJAVAC_CLASSNAME
COMPILER_GCJback to summary
public static final String COMPILER_GCJ
COMPILER_JAVAC_10_PLUSback to summary
public static final String COMPILER_JAVAC_10_PLUS
COMPILER_JAVAC_1_1back to summary
public static final String COMPILER_JAVAC_1_1
COMPILER_JAVAC_1_2back to summary
public static final String COMPILER_JAVAC_1_2
COMPILER_JAVAC_1_3back to summary
public static final String COMPILER_JAVAC_1_3
COMPILER_JAVAC_1_4back to summary
public static final String COMPILER_JAVAC_1_4
COMPILER_JAVAC_1_5back to summary
public static final String COMPILER_JAVAC_1_5
COMPILER_JAVAC_1_6back to summary
public static final String COMPILER_JAVAC_1_6
COMPILER_JAVAC_1_7back to summary
public static final String COMPILER_JAVAC_1_7
COMPILER_JAVAC_1_8back to summary
public static final String COMPILER_JAVAC_1_8
COMPILER_JAVAC_9back to summary
public static final String COMPILER_JAVAC_9
COMPILER_JAVAC_9_ALIASback to summary
public static final String COMPILER_JAVAC_9_ALIAS
COMPILER_JIKESback to summary
public static final String COMPILER_JIKES
COMPILER_JVCback to summary
public static final String COMPILER_JVC
COMPILER_JVC_ALIASback to summary
public static final String COMPILER_JVC_ALIAS
COMPILER_KJCback to summary
public static final String COMPILER_KJC
COMPILER_MODERNback to summary
public static final String COMPILER_MODERN
COMPILER_MODERN_CLASSNAMEback to summary
public static final String COMPILER_MODERN_CLASSNAME
COMPILER_SYMANTECback to summary
public static final String COMPILER_SYMANTEC
COMPILER_SYMANTEC_ALIASback to summary
public static final String COMPILER_SYMANTEC_ALIAS
FORKED_JDK_COMPILERSback to summary
private static final List<String> FORKED_JDK_COMPILERS
JDK_COMPILER_NICKNAMESback to summary
private static final List<String> JDK_COMPILER_NICKNAMES
JDK_COMPILERSback to summary
private static final List<String> JDK_COMPILERS
MODERN_COMPILERback to summary
private static final String MODERN_COMPILER
MODERN_JDK_COMPILERSback to summary
private static final List<String> MODERN_JDK_COMPILERS

Constructor Detail

CompilerAdapterFactoryback to summary
private CompilerAdapterFactory()

This is a singleton -- can't create instances!!

Method Detail

containsIgnoreCaseback to summary
private static boolean containsIgnoreCase(final List<String> compilers, final String compilerName)
doesModernCompilerExistback to summary
private static boolean doesModernCompilerExist()

query for the Modern compiler existing

Returns:boolean

true if classic os on the classpath

getCompilerback to summary
public static CompilerAdapter getCompiler(String compilerType, Task task) throws BuildException

Based on the parameter passed in, this method creates the necessary factory desired. The current mapping for compiler names are as follows:

  • jikes = jikes compiler
  • classic, javac1.1, javac1.2 = the standard compiler from JDK 1.1/1.2
  • modern, javac1.3, javac1.4, javac1.5 = the compiler of JDK 1.3+
  • jvc, microsoft = the command line compiler from Microsoft's SDK for Java / Visual J++
  • kjc = the kopi compiler
  • gcj = the gcj compiler from gcc
  • sj, symantec = the Symantec Java compiler
  • a fully qualified classname = the name of a compiler adapter
Parameters
compilerType:String

either the name of the desired compiler, or the full classname of the compiler's adapter.

task:Task

a task to log through.

Returns:CompilerAdapter

the compiler adapter

Exceptions
BuildException:
if the compiler type could not be resolved into a compiler adapter.
getCompilerback to summary
public static CompilerAdapter getCompiler(String compilerType, Task task, Path classpath) throws BuildException

Based on the parameter passed in, this method creates the necessary factory desired. The current mapping for compiler names are as follows:

  • jikes = jikes compiler
  • classic, javac1.1, javac1.2 = the standard compiler from JDK 1.1/1.2
  • modern, javac1.3, javac1.4, javac1.5 = the compiler of JDK 1.3+
  • jvc, microsoft = the command line compiler from Microsoft's SDK for Java / Visual J++
  • kjc = the kopi compiler
  • gcj = the gcj compiler from gcc
  • sj, symantec = the Symantec Java compiler
  • a fully qualified classname = the name of a compiler adapter
Parameters
compilerType:String

either the name of the desired compiler, or the full classname of the compiler's adapter.

task:Task

a task to log through.

classpath:Path

the classpath to use when looking up an adapter class

Returns:CompilerAdapter

the compiler adapter

Exceptions
BuildException:
if the compiler type could not be resolved into a compiler adapter.
Since
Ant 1.8.0
isClassicJdkCompilerback to summary
public static boolean isClassicJdkCompiler(final String compilerName)

Does the compiler correspond to "classic"?

Parameters
compilerName:String

the name of the compiler implementation

Since
1.10.12
isForkedJavacback to summary
public static boolean isForkedJavac(final String compilerName)

Is the compiler implementation a forked jdk compiler?

Parameters
compilerName:String

the name of the compiler implementation

Since
1.10.12
isJdkCompilerback to summary
public static boolean isJdkCompiler(final String compilerName)

Is the compiler implementation a jdk compiler?

Parameters
compilerName:String

the name of the compiler implementation

Since
1.10.12
isJdkCompilerNicknameback to summary
public static boolean isJdkCompilerNickname(final String compilerName)

Is the compiler implementation a jdk compiler without specified version?

Parameters
compilerName:String

the name of the compiler implementation

Since
1.10.12
isModernJdkCompilerback to summary
public static boolean isModernJdkCompiler(final String compilerName)

Does the compiler correspond to "modern"?

Parameters
compilerName:String

the name of the compiler implementation

Since
1.10.12
resolveClassNameback to summary
private static CompilerAdapter resolveClassName(String className, ClassLoader loader) throws BuildException

Tries to resolve the given classname into a compiler adapter. Throws a fit if it can't.

Parameters
className:String

The fully qualified classname to be created.

loader:ClassLoader

the classloader to use

Exceptions
BuildException:
This is the fit that is thrown if className isn't an instance of CompilerAdapter.