Interface CompilationResult
@ProviderType
public interface CompilationResult
The compilation result allows clients of the java compiler
to check for error messages, warnings (if not disabled by
the options) and allows to access the compiled classes.
- Since:
- 2.0
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Was a compilation required or were all classes recent?Return a list of error messages that occured during compilation.Return a list of warnings that occured during compilation.Class<?>
loadCompiledClass
(String className) Try to load the compiled class.
-
Method Details
-
getErrors
List<CompilerMessage> getErrors()Return a list of error messages that occured during compilation. If no errors occurednull
is returned.- Returns:
- A list of error messages or
null
.
-
getWarnings
List<CompilerMessage> getWarnings()Return a list of warnings that occured during compilation. If no warnings occurednull
is returned.- Returns:
- A list of warnings or
null
.
-
didCompile
boolean didCompile()Was a compilation required or were all classes recent?- Returns:
true
if classes were compiled.
-
loadCompiledClass
Try to load the compiled class. The class loading might fail if the className is not one of the compiled sources, if the compilation failed or if a class loader writer has been used in combination with a class loader that is not able to load the classes written by the class loader writer.- Parameters:
className
- The class name of the compiled class.- Returns:
- The compiled class
- Throws:
ClassNotFoundException
- If the class could not be found or compilation failed.
-