Package com.karuslabs.elementary
Class Compiler
java.lang.Object
com.karuslabs.elementary.Compiler
Represents a Java compiler.
-
Method Summary
Modifier and TypeMethodDescriptionclasspath(ClassLoader loader) Adds the classpath of the givenClassLoaderas the compilation classpath.classpath(Collection<File> files) Adds the given classpath as the compilation classpath.compile(Iterable<? extends JavaFileObject> files) Compiles the given Java source files.compile(JavaFileObject... files) Compiles the given Java source files.Adds the current classpath as the compilation classpath.static Compilerjavac()Creates a Java compiler.Adds the module and its transitive dependencies to the compilation classpath.Adds the given compiler options to thisCompiler.options(Collection<String> options) Adds the given compiler options to thisCompiler.processors(Collection<Processor> processors) Adds the given annotation processors to thisCompiler.processors(Processor... processors) Adds the given annotation processors to thisCompiler.
-
Method Details
-
javac
Creates a Java compiler.- Returns:
- a Java compiler
-
compile
Compiles the given Java source files.- Parameters:
files- the Java source files to be compiled- Returns:
- the results of this compilation
-
compile
Compiles the given Java source files.- Parameters:
files- the Java source files to be compiled- Returns:
- the results of this compilation
-
processors
Adds the given annotation processors to thisCompiler.- Parameters:
processors- the annotation processors- Returns:
this
-
processors
Adds the given annotation processors to thisCompiler.- Parameters:
processors- the annotation processors- Returns:
this
-
options
Adds the given compiler options to thisCompiler.- Parameters:
options- the compiler options- Returns:
this- See Also:
-
options
Adds the given compiler options to thisCompiler.- Parameters:
options- the compiler options- Returns:
this- See Also:
-
module
Adds the module and its transitive dependencies to the compilation classpath.- Parameters:
module- the module- Returns:
this
-
currentClasspath
Adds the current classpath as the compilation classpath.- Returns:
this
-
classpath
Adds the classpath of the givenClassLoaderas the compilation classpath.- Parameters:
loader- theClassLoaderwhich classpath is to be used during compilation- Returns:
this- Throws:
IllegalArgumentException- if the givenClassLoaderor its parents are neitherURLClassLoaders nor the system/platform classloader, or if they contain a classpath with folders
-
classpath
Adds the given classpath as the compilation classpath.- Parameters:
files- the compilation classpath- Returns:
this
-