io.sarl.lang.compiler.batch
Class SarlBatchCompiler
class SarlBatchCompiler
extends java.lang.Object
The compiler from SARL that could be used for batch tasks (Maven, CLI).

This compiler is inspired by the Xtend batch compiler.
Maven Group Identifier:
io.sarl.lang
Maven Artifact Identifier:
batchcompiler
Since:
0.5
Property Summary
Modifier and type Property and description
java.io.File classOutputPath
Replies the path where the class files are generated.
java.util.List<E> classPath
Replies the classpath.
CleaningPolicy cleaningPolicy
Replies the cleaning policy that is applied by this batch compiler.
java.lang.ClassLoader currentClassLoader
Replies the current class loader.
java.lang.String extraLanguageGenerators
Replies the extra languages' generators that should be enabled.
java.lang.String fileEncoding
Change the file encoding.
java.lang.String generatedAnnotationComment
Replies the comment in the @Generated annnotations.
protected org.eclipse.xtext.xbase.compiler.GeneratorConfig generatorConfig
Replies the current generator config.
protected GeneratorConfig2 generatorConfig2
Replies the current generator config v2.
java.util.Comparator<T> issueComparator
Replies the comparator of issues that is used for sorting the issues before they are logged.
IssueMessageFormatter issueMessageFormatter
Replies the formatter of the issue messages.
IJavaBatchCompiler javaCompiler
Replies the Java compiler.
java.lang.String javaSourceVersion
Replies the version of the Java source to be used for the generated Java files.
java.util.logging.Logger logger
Replies the logger.
java.util.List<E> modulePath
Replies the module-path.
OptimizationLevel optimizationLevel
Replies the optimization level that should be applied to the generated Java byte code.
java.io.File outputPath
Replies the path where the Java files are generated.
boolean reportInternalProblemsAsIssues
Replies the flag that indicates to report the compiler's internal problems as issues.
boolean reportWarningsAsErrors
Replies the flag that permits to report the warning issues detected by the SARL compiler as errors to the user of the batch compiler.
java.util.List<E> sourcePaths
Replies the source path.
java.io.File tempDirectory
Replies the path where the Xtext stubs are generated.
Field Summary
Modifier and type Field and description
protected var javax.inject.Provider<T> resourceSetProvider
The provider of resource sets.
Constructor Summary
Constructor and description
new
Constructor the batch compiler.
Action Summary
Modifier and type Action and description
void addCompiledResourceReceiver(ICompilatedResourceReceiver)
Add a receiver on the successfully compiled resources.
void addIssueMessageListener(IssueMessageListener)
Add a listener on the issue messages.
void addSourcePath(File)
Add a folder to the source path.
void addSourcePath(String)
Add a folder to the source path.
protected boolean checkConfiguration(IProgressMonitor)
Check the compiler configuration; and logs errors.
protected boolean cleanFolder(File,FileFilter)
Clean the folders.
boolean compile
Run the compilation.
boolean compile(IProgressMonitor)
Run the compilation.
boolean compile(CancelIndicator)
Run the compilation.
protected java.lang.ClassLoader createClassLoader(Iterable<T>,Iterable<T>,ClassLoader)
Create the project class loader.
protected java.lang.String createIssueMessage(Severity,Issue)
Create a message for the issue.
protected java.io.File createStubs(ResourceSet,IProgressMonitor)
Create the stubs.
protected java.io.File createTempDir(String)
Create a temporary subdirectory inside the root temp directory.
protected java.io.File createTempDirectory
Create the temp directory that should be used by the compiler.
protected void destroyClassLoader(ClassLoader)
Null-safe destruction of the given class loaders.
protected void generateJavaFiles(Iterable<T>,IProgressMonitor)
Generate the Java files from the SARL scripts.
protected void generateJvmElements(ResourceSet,IProgressMonitor)
Generate the JVM model elements.
java.io.File getClassOutputPath
Replies the path where the class files are generated.
java.util.List<E> getClassPath
Replies the classpath.
CleaningPolicy getCleaningPolicy
Replies the cleaning policy that is applied by this batch compiler.
java.lang.ClassLoader getCurrentClassLoader
Replies the current class loader.
java.lang.String getExtraLanguageGenerators
Replies the extra languages' generators that should be enabled.
java.lang.String getFileEncoding
Change the file encoding.
java.lang.String getGeneratedAnnotationComment
Replies the comment in the @Generated annnotations.
protected org.eclipse.xtext.xbase.compiler.GeneratorConfig getGeneratorConfig
Replies the current generator config.
protected GeneratorConfig2 getGeneratorConfig2
Replies the current generator config v2.
java.util.Comparator<T> getIssueComparator
Replies the comparator of issues that is used for sorting the issues before they are logged.
IssueMessageFormatter getIssueMessageFormatter
Replies the formatter of the issue messages.
IJavaBatchCompiler getJavaCompiler
Replies the Java compiler.
java.lang.String getJavaSourceVersion
Replies the version of the Java source to be used for the generated Java files.
java.util.logging.Logger getLogger
Replies the logger.
java.util.List<E> getModulePath
Replies the module-path.
OptimizationLevel getOptimizationLevel
Replies the optimization level that should be applied to the generated Java byte code.
java.io.File getOutputPath
Replies the path where the Java files are generated.
boolean getReportInternalProblemsAsIssues
Replies the flag that indicates to report the compiler's internal problems as issues.
boolean getReportWarningsAsErrors
Replies the flag that permits to report the warning issues detected by the SARL compiler as errors to the user of the batch compiler.
java.util.List<E> getSourcePaths
Replies the source path.
java.io.File getTempDirectory
Replies the path where the Xtext stubs are generated.
boolean isDeleteTempDirectory
Replies if the temp folder must be deleted at the end of the compilation.
Deprecated for removal since 0.10: since 0.10, see getCleaningPolicy().
boolean isGenerateCloneFunctions
Replies if the clone functions shall be generated.
boolean isGenerateEqualityTestFunctions
Replies if the equality test functions shall be generated.
boolean isGenerateExpressions
Replies the compiler generate the Xbase expressions.
boolean isGenerateGeneratedAnnotation
Replies the @Generated is generated.
boolean isGenerateInlineAnnotation
Replies if the @Inline shall be generated.
boolean isGeneratePureAnnotation
Replies if the @Pure shall be generated.
boolean isGenerateSerialNumberFields
Replies if the serial number fields shall be generated.
boolean isGenerateSyntheticSuppressWarnings
Replies the @SuppressWarnings is generated.
boolean isGenerateToStringFunctions
Replies if the toString functions shall be generated.
boolean isIncludeDateInGeneratedAnnotation
Replies if the generation date is included in the @Generated annotations.
boolean isJavaCompilerVerbose
Replies if the compiler is verbose.
boolean isJavaPostCompilationEnable
Replies if the Java compiler should be invoked after the SARL compiler is invoked.
boolean isModularProject
Replies if the current project is modular.
boolean isModuleSupported
Replies if the current batch compiler (and its undergoing Java compiler) supports the Java modules.
boolean isSarlCompilationEnable
Replies if the SARL compiler should be invoked before the Java compiler is invoked.
protected boolean isSourceFile(Resource)
Replies if the given resource is a script.
boolean isUseCurrentClassLoaderAsParent
Replies if the class loaderr of this batch compiler must be used as sthe parent class loader.
boolean isUseExpressionInterpreterForInlineAnnotation
Replies if constant expression interpreter shall be called for generated @Inline.
boolean isWriteStorageFiles
Replies if the storage files must be generated.
boolean isWriteTraceFiles
Replies if the trace files must be generated.
protected void loadSARLFiles(ResourceSet,IProgressMonitor)
Load the SARL files in the given resource set.
protected void overrideXtextInternalLoggers
Change the loggers that are internally used by Xtext.
protected CompilerStatus postCompileJava(IProgressMonitor)
Compile the java files after the compilation of the project's files.
protected CompilerStatus preCompileJava(File,File,IProgressMonitor)
Compile the java files before the compilation of the project's files.
protected CompilerStatus preCompileStubs(File,File,IProgressMonitor)
Compile the stub files before the compilation of the project's files.
void removeCompiledResourceReceiver(ICompilatedResourceReceiver)
Remove a receiver on the successfully compiled resources.
void removeIssueMessageListener(IssueMessageListener)
Add a listener on the issue messages.
protected boolean reportCompilationIssues(Iterable<T>)
Output the given issues that result from the compilation of the SARL code.
protected void reportInternalError(String,Object*)
Reports the given error message.
protected void reportInternalError(String,Throwable)
Reports the given error message.
protected void reportInternalInfo(String,Object*)
Reports the given information message.
protected void reportInternalWarning(String)
Reports the given warning message.
protected void reportInternalWarning(String,Throwable)
Reports the given warning message.
protected CompilerStatus runJavaCompiler(File,Iterable<T>,Iterable<T>,Iterable<T>,boolean,boolean,IProgressMonitor)
Run the Java compiler.
void setAllWarningSeverities(Severity)
Change the severity level of for all the warnings.
void setBasePath(String)
Change the base path.
void setBaseURI(URI)
Change the base URI.
void setClassOutputPath(File)
Set the path where the class files are generated.
void setClassPath(String)
Change the classpath.
void setClassPath(Collection<E>)
Change the classpath.
void setCleaningPolicy(CleaningPolicy)
Change the cleaning policy that is applied by this batch compiler.
void setCurrentClassLoader(ClassLoader)
Set the current class loader.
void setDeleteTempDirectory(boolean)
Set if the temp folder must be deleted at the end of the compilation.
Deprecated for removal since 0.10: since 0.10, see setCleaningPolicy(CleaningPolicy).
void setExtraLanguageGenerators(String)
Change the extra languages' generators that should be enabled.
void setFileEncoding(String)
Change the file encoding.
void setGenerateCloneFunctions(boolean)
Set if the clone functions shall be generated.
void setGeneratedAnnotationComment(String)
Set the comment in the @Generated annnotations.
void setGenerateEqualityTestFunctions(boolean)
Set if the equality test functions shall be generated.
void setGenerateExpressions(boolean)
Set if the compiler generate the Xbase expressions.
void setGenerateGeneratedAnnotation(boolean)
Set if the @Generated is generated.
void setGenerateInlineAnnotation(boolean)
Set if the @Inline shall be generated.
void setGeneratePureAnnotation(boolean)
Set if the @Pure shall be generated.
void setGenerateSerialNumberFields(boolean)
Set if the serial number fields shall be generated.
void setGenerateSyntheticSuppressWarnings(boolean)
Set if the @SuppressWarnings is generated.
void setGenerateToStringFunctions(boolean)
Set if the toString functions shall be generated.
void setIncludeDateInGeneratedAnnotation(boolean)
Set if the generation date is included in the @Generated annotations.
void setIssueComparator(Comparator<T>)
Set the comparator of issues that is used for sorting the issues before they are logged.
void setIssueMessageFormatter(IssueMessageFormatter)
Set the formatter of the issue messages.
void setJavaCompiler(IJavaBatchCompiler)
Change the Java compiler.
void setJavaCompilerVerbose(boolean)
Set the underlying Java compiler verbosity.
void setJavaPostCompilationEnable(boolean)
Set if the Java compiler should be invoked after the SARL compiler is invoked.
void setJavaSourceVersion(String)
Change the version of the Java source to be used for the generated Java files.
void setLogger(Logger)
Set the logger.
void setModulePath(String)
Change the module-path.
void setModulePath(Collection<E>)
Change the module-path.
void setOptimizationLevel(OptimizationLevel)
Change the optimization level that should be applied to the generated Java byte code.
void setOutputPath(File)
Change the path where the Java files are generated.
void setOutputPath(String)
Change the path where the Java files are generated.
void setReportInternalProblemsAsIssues(boolean)
Change the flag that permits to report the compiler's internal problems as issues.
void setReportWarningsAsErrors(boolean)
Change the flag that permits to report the warning issues detected by the SARL compiler as errors to the user of the batch compiler.
void setResourceSetProvider(Provider<T>)
Set the provider of resource sets.
void setSarlCompilationEnable(boolean)
Set if the SARL compiler should be invoked before the Java compiler is invoked.
void setSourcePath(String)
Change the source path.
void setSourcePath(Collection<E>)
Change the source path.
void setTempDirectory(File)
Change the path where the Xtext stubs are generated.
void setTempDirectory(String)
Change the path where the Xtext stubs are generated.
void setUseCurrentClassLoaderAsParent(boolean)
Set if the class loaderr of this batch compiler must be used as sthe parent class loader.
void setUseExpressionInterpreterForInlineAnnotation(boolean)
Set if the constant expression interpreter shall be called for generated @Inline.
void setWarningSeverity(String,Severity)
Change the severity level of a warning.
void setWriteStorageFiles(boolean)
Set if the storage files must be generated.
void setWriteTraceFiles(boolean)
Set if the trace files must be generated.
protected java.util.List<E> validate(ResourceSet,Collection<E>,IProgressMonitor)
Generate the JVM model elements, and validate generated elements.
Property Details
classOutputPath
var classOutputPath : java.io.File
Replies the path where the class files are generated.

This property is an alias for the action: getClassOutputPath

Returns:
the path; or null for ignoring the class generation.
classPath
var classPath : java.util.List<E>
Replies the classpath.

This property is an alias for the action: getClassPath

Returns:
the classpath.
cleaningPolicy
var cleaningPolicy : CleaningPolicy
Replies the cleaning policy that is applied by this batch compiler.

This property is an alias for the action: getCleaningPolicy

Returns:
the cleaning policy, never null .
Since:
0.10
currentClassLoader
var currentClassLoader : java.lang.ClassLoader
Replies the current class loader.

This property is an alias for the action: getCurrentClassLoader

Returns:
the class loader.
extraLanguageGenerators
var extraLanguageGenerators : java.lang.String
Replies the extra languages' generators that should be enabled.

This property is an alias for the action: getExtraLanguageGenerators

Returns:
the identifier, the identifiers (separated by pathSeparator of the extra languages' generator(s) to be enabled. If this parameter is null , all the extra languages' generator are disabled.
Since:
0.8
fileEncoding
var fileEncoding : java.lang.String
Change the file encoding.

This property is an alias for the action: getFileEncoding

Returns:
the file encoding, or null if the default encoding must be used.
generatedAnnotationComment
var generatedAnnotationComment : java.lang.String
Replies the comment in the @Generated annnotations.

This property is an alias for the action: getGeneratedAnnotationComment

Returns:
the comment.
generatorConfig
protected val generatorConfig : org.eclipse.xtext.xbase.compiler.GeneratorConfig
Replies the current generator config.

This property is an alias for the action: getGeneratorConfig

Returns:
the generator config.
generatorConfig2
protected val generatorConfig2 : GeneratorConfig2
Replies the current generator config v2.

This property is an alias for the action: getGeneratorConfig2

Returns:
the generator config v2.
issueComparator
var issueComparator : java.util.Comparator<T>
Replies the comparator of issues that is used for sorting the issues before they are logged.

This property is an alias for the action: getIssueComparator

Returns:
the comparator; never null .
issueMessageFormatter
var issueMessageFormatter : IssueMessageFormatter
Replies the formatter of the issue messages.

This property is an alias for the action: getIssueMessageFormatter

Returns:
the formatter.
javaCompiler
var javaCompiler : IJavaBatchCompiler
Replies the Java compiler.

This property is an alias for the action: getJavaCompiler

Returns:
the Java compiler
Since:
0.8
javaSourceVersion
var javaSourceVersion : java.lang.String
Replies the version of the Java source to be used for the generated Java files.

This property is an alias for the action: getJavaSourceVersion

Returns:
the Java version.
logger
var logger : java.util.logging.Logger
Replies the logger.

This property is an alias for the action: getLogger

Returns:
the logger.
modulePath
var modulePath : java.util.List<E>
Replies the module-path. This function replies the empty list if the current version of Java is not supporting modules.

This property is an alias for the action: getModulePath

Returns:
the module-path.
Since:
0.12
optimizationLevel
var optimizationLevel : OptimizationLevel
Replies the optimization level that should be applied to the generated Java byte code.

This property is an alias for the action: getOptimizationLevel

Returns:
the optimization level.
Since:
0.8
outputPath
var outputPath : java.io.File
Replies the path where the Java files are generated.

This property is an alias for the action: getOutputPath

Returns:
the path; or null for using the default path in SARLConfig#FOLDER_SOURCE_GENERATED .
reportInternalProblemsAsIssues
var reportInternalProblemsAsIssues : boolean
Replies the flag that indicates to report the compiler's internal problems as issues.

This property is an alias for the action: getReportInternalProblemsAsIssues

Returns:
true if the internal errors are reported as issues.
Since:
0.8
See:
addIssueMessageListener(IssueMessageListener)
reportWarningsAsErrors
var reportWarningsAsErrors : boolean
Replies the flag that permits to report the warning issues detected by the SARL compiler as errors to the user of the batch compiler.

This property is an alias for the action: getReportWarningsAsErrors

Returns:
true if the warnings are reported as errors.
Since:
0.13
See:
addIssueMessageListener(IssueMessageListener)
sourcePaths
val sourcePaths : java.util.List<E>
Replies the source path.

This property is an alias for the action: getSourcePaths

Returns:
the source path.
tempDirectory
var tempDirectory : java.io.File
Replies the path where the Xtext stubs are generated.

This property is an alias for the action: getTempDirectory

Returns:
the path; or null for using the default path.
Field Details
resourceSetProvider
protected var resourceSetProvider : javax.inject.Provider<T>
The provider of resource sets.
Constructor Details
new
new
Constructor the batch compiler.
Action Details
addCompiledResourceReceiver(ICompilatedResourceReceiver)
def addCompiledResourceReceiver(ICompilatedResourceReceiver)
Add a receiver on the successfully compiled resources.
Parameters:
receiver - the receiver.
Since:
0.6
addIssueMessageListener(IssueMessageListener)
def addIssueMessageListener(IssueMessageListener)
Add a listener on the issue messages.
Parameters:
listener - the listener.
Since:
0.6
addSourcePath(File)
def addSourcePath(File)
Add a folder to the source path.
Parameters:
sourcePath - the new source path.
addSourcePath(String)
def addSourcePath(String)
Add a folder to the source path.
Parameters:
sourcePath - the new source path.
checkConfiguration(IProgressMonitor)
protected def checkConfiguration(IProgressMonitor) : boolean
Check the compiler configuration; and logs errors.
Parameters:
progress - monitor of the progress of the compilation.
Returns:
success status. Replies false if the operation is canceled.
cleanFolder(File,FileFilter)
protected def cleanFolder(File,FileFilter) : boolean
Clean the folders.
Parameters:
parentFolder - the parent folder.
filter - the file filter for the file to remove.
Returns:
the success status.
compile
def compile : boolean
Run the compilation.
Returns:
success status.
compile(IProgressMonitor)
def compile(IProgressMonitor) : boolean
Run the compilation.
Parameters:
progress - monitor of the progress of the compilation.
Returns:
success status.
Since:
0.8
compile(CancelIndicator)
def compile(CancelIndicator) : boolean
Run the compilation.
Parameters:
cancel - is the tool for canceling the compilation.
Returns:
success status.
createClassLoader(Iterable<T>,Iterable<T>,ClassLoader)
protected def createClassLoader(Iterable<T>,Iterable<T>,ClassLoader) : java.lang.ClassLoader
Create the project class loader.
Parameters:
classPath - the project class path.
modulePath - the project class path.
parentClassLoader - the parent class loader.
Returns:
the class loader for the project.
createIssueMessage(Severity,Issue)
protected def createIssueMessage(Severity,Issue) : java.lang.String
Create a message for the issue.
Parameters:
severity - the severity that is considered by the compiler. It may be stronger than the one specified in the issue.
issue - the issue.
Returns:
the message.
createStubs(ResourceSet,IProgressMonitor)
protected def createStubs(ResourceSet,IProgressMonitor) : java.io.File
Create the stubs.
Parameters:
resourceSet - the input resource set.
progress - monitor of the progress of the compilation.
Returns:
the folder in which the stubs are located. Replies null if the activity is canceled.
createTempDir(String)
protected def createTempDir(String) : java.io.File
Create a temporary subdirectory inside the root temp directory.
Parameters:
namePrefix - the prefix for the folder name.
Returns:
the temp directory.
See:
getTempDirectory
createTempDirectory
protected def createTempDirectory : java.io.File
Create the temp directory that should be used by the compiler.
Returns:
the temp directory, never null .
destroyClassLoader(ClassLoader)
protected def destroyClassLoader(ClassLoader)
Null-safe destruction of the given class loaders.
Parameters:
classLoader - the class loader to destroy.
generateJavaFiles(Iterable<T>,IProgressMonitor)
protected def generateJavaFiles(Iterable<T>,IProgressMonitor)
Generate the Java files from the SARL scripts.
Parameters:
validatedResources - the validatedResources for which the Java files could be generated.
progress - monitor of the progress of the compilation.
generateJvmElements(ResourceSet,IProgressMonitor)
protected def generateJvmElements(ResourceSet,IProgressMonitor)
Generate the JVM model elements.
Parameters:
progress - monitor of the progress of the compilation.
resourceSet - the container of the scripts.
getClassOutputPath
def getClassOutputPath : java.io.File
Replies the path where the class files are generated.
Returns:
the path; or null for ignoring the class generation.
getClassPath
def getClassPath : java.util.List<E>
Replies the classpath.
Returns:
the classpath.
getCleaningPolicy
def getCleaningPolicy : CleaningPolicy
Replies the cleaning policy that is applied by this batch compiler.
Returns:
the cleaning policy, never null .
Since:
0.10
getCurrentClassLoader
def getCurrentClassLoader : java.lang.ClassLoader
Replies the current class loader.
Returns:
the class loader.
getExtraLanguageGenerators
def getExtraLanguageGenerators : java.lang.String
Replies the extra languages' generators that should be enabled.
Returns:
the identifier, the identifiers (separated by pathSeparator of the extra languages' generator(s) to be enabled. If this parameter is null , all the extra languages' generator are disabled.
Since:
0.8
getFileEncoding
def getFileEncoding : java.lang.String
Change the file encoding.
Returns:
the file encoding, or null if the default encoding must be used.
getGeneratedAnnotationComment
def getGeneratedAnnotationComment : java.lang.String
Replies the comment in the @Generated annnotations.
Returns:
the comment.
getGeneratorConfig
protected def getGeneratorConfig : org.eclipse.xtext.xbase.compiler.GeneratorConfig
Replies the current generator config.
Returns:
the generator config.
getGeneratorConfig2
protected def getGeneratorConfig2 : GeneratorConfig2
Replies the current generator config v2.
Returns:
the generator config v2.
getIssueComparator
def getIssueComparator : java.util.Comparator<T>
Replies the comparator of issues that is used for sorting the issues before they are logged.
Returns:
the comparator; never null .
getIssueMessageFormatter
def getIssueMessageFormatter : IssueMessageFormatter
Replies the formatter of the issue messages.
Returns:
the formatter.
getJavaCompiler
def getJavaCompiler : IJavaBatchCompiler
Replies the Java compiler.
Returns:
the Java compiler
Since:
0.8
getJavaSourceVersion
def getJavaSourceVersion : java.lang.String
Replies the version of the Java source to be used for the generated Java files.
Returns:
the Java version.
getLogger
def getLogger : java.util.logging.Logger
Replies the logger.
Returns:
the logger.
getModulePath
def getModulePath : java.util.List<E>
Replies the module-path. This function replies the empty list if the current version of Java is not supporting modules.
Returns:
the module-path.
Since:
0.12
getOptimizationLevel
def getOptimizationLevel : OptimizationLevel
Replies the optimization level that should be applied to the generated Java byte code.
Returns:
the optimization level.
Since:
0.8
getOutputPath
def getOutputPath : java.io.File
Replies the path where the Java files are generated.
Returns:
the path; or null for using the default path in SARLConfig#FOLDER_SOURCE_GENERATED .
getReportInternalProblemsAsIssues
def getReportInternalProblemsAsIssues : boolean
Replies the flag that indicates to report the compiler's internal problems as issues.
Returns:
true if the internal errors are reported as issues.
Since:
0.8
See:
addIssueMessageListener(IssueMessageListener)
getReportWarningsAsErrors
def getReportWarningsAsErrors : boolean
Replies the flag that permits to report the warning issues detected by the SARL compiler as errors to the user of the batch compiler.
Returns:
true if the warnings are reported as errors.
Since:
0.13
See:
addIssueMessageListener(IssueMessageListener)
getSourcePaths
def getSourcePaths : java.util.List<E>
Replies the source path.
Returns:
the source path.
getTempDirectory
def getTempDirectory : java.io.File
Replies the path where the Xtext stubs are generated.
Returns:
the path; or null for using the default path.
isDeleteTempDirectory
def isDeleteTempDirectory : boolean
Replies if the temp folder must be deleted at the end of the compilation.
Returns:
true if the temp folder is deleted.
Deprecated:
since 0.10, see getCleaningPolicy() .
isGenerateCloneFunctions
def isGenerateCloneFunctions : boolean
Replies if the clone functions shall be generated.
Returns:
true if the functions shall be generated.
Since:
0.8
isGenerateEqualityTestFunctions
def isGenerateEqualityTestFunctions : boolean
Replies if the equality test functions shall be generated.
Returns:
true if the functions shall be generated.
Since:
0.8
isGenerateExpressions
def isGenerateExpressions : boolean
Replies the compiler generate the Xbase expressions.
Returns:
true if the compiler generates the expressions
isGenerateGeneratedAnnotation
def isGenerateGeneratedAnnotation : boolean
Replies the @Generated is generated.
Returns:
true if the compiler generates the generated annotations.
isGenerateInlineAnnotation
def isGenerateInlineAnnotation : boolean
Replies if the @Inline shall be generated.
Returns:
true if annotation shall be generated.
isGeneratePureAnnotation
def isGeneratePureAnnotation : boolean
Replies if the @Pure shall be generated.
Returns:
true if annotation shall be generated.
isGenerateSerialNumberFields
def isGenerateSerialNumberFields : boolean
Replies if the serial number fields shall be generated.
Returns:
true if the fields shall be generated.
Since:
0.8
isGenerateSyntheticSuppressWarnings
def isGenerateSyntheticSuppressWarnings : boolean
Replies the @SuppressWarnings is generated.
Returns:
true if the compiler generates the warning supression annotations.
isGenerateToStringFunctions
def isGenerateToStringFunctions : boolean
Replies if the toString functions shall be generated.
Returns:
true if the functions shall be generated.
Since:
0.8
isIncludeDateInGeneratedAnnotation
def isIncludeDateInGeneratedAnnotation : boolean
Replies if the generation date is included in the @Generated annotations.
Returns:
true if the generation date is added.
isJavaCompilerVerbose
def isJavaCompilerVerbose : boolean
Replies if the compiler is verbose.
Returns:
true if the compiler is verbose.
isJavaPostCompilationEnable
def isJavaPostCompilationEnable : boolean
Replies if the Java compiler should be invoked after the SARL compiler is invoked.
Returns:
true if the Java compiler is invoked after the SARL compiler.
isModularProject
def isModularProject : boolean
Replies if the current project is modular. A project is module when it defines the "module-info.java" file.
Returns:
true if the project is detected as modular.
Since:
0.12
isModuleSupported
def isModuleSupported : boolean
Replies if the current batch compiler (and its undergoing Java compiler) supports the Java modules.
Returns:
true if the Java modules are supported.
Since:
0.12
isSarlCompilationEnable
def isSarlCompilationEnable : boolean
Replies if the SARL compiler should be invoked before the Java compiler is invoked.
Returns:
true if the SARL compiler is invoked before the Java compiler.
Since:
0.12
isSourceFile(Resource)
protected def isSourceFile(Resource) : boolean
Replies if the given resource is a script.
Parameters:
resource - the resource to test.
Returns:
true if the given resource is a script.
isUseCurrentClassLoaderAsParent
def isUseCurrentClassLoaderAsParent : boolean
Replies if the class loaderr of this batch compiler must be used as sthe parent class loader.
Returns:
true for using the class loader of this batch compiler.
isUseExpressionInterpreterForInlineAnnotation
def isUseExpressionInterpreterForInlineAnnotation : boolean
Replies if constant expression interpreter shall be called for generated @Inline.
Returns:
true if annotation shall be generated.
isWriteStorageFiles
def isWriteStorageFiles : boolean
Replies if the storage files must be generated.

The storage files are binary versions of the resources in order to have faster reading/accessing.

The usual filename for the storage files follows the pattern .Type.sarlbin, where Type is the name of the SARL type declaration.
Returns:
true for generation.
isWriteTraceFiles
def isWriteTraceFiles : boolean
Replies if the trace files must be generated.

A trace file contains the links between the class, java and SARL files. They are mandatory for retrieving and displaying the SARL source code from a JVM element.

The usual filename for the trace files follows the pattern .Type.java._trace, where Type is the name of the SARL type declaration.
Returns:
true for generation.
loadSARLFiles(ResourceSet,IProgressMonitor)
protected def loadSARLFiles(ResourceSet,IProgressMonitor)
Load the SARL files in the given resource set.
Parameters:
progress - monitor of the progress of the compilation.
resourceSet - the resource set to load from.
overrideXtextInternalLoggers
protected def overrideXtextInternalLoggers
Change the loggers that are internally used by Xtext.
postCompileJava(IProgressMonitor)
protected def postCompileJava(IProgressMonitor) : CompilerStatus
Compile the java files after the compilation of the project's files.
Parameters:
progress - monitor of the progress of the compilation.
Returns:
the success status.
preCompileJava(File,File,IProgressMonitor)
protected def preCompileJava(File,File,IProgressMonitor) : CompilerStatus
Compile the java files before the compilation of the project's files.
Parameters:
sourceDirectory - the source directory where java files are stored.
classDirectory - the output directory, where binary files should be generated.
progress - monitor of the progress of the compilation.
Returns:
the success status.
preCompileStubs(File,File,IProgressMonitor)
protected def preCompileStubs(File,File,IProgressMonitor) : CompilerStatus
Compile the stub files before the compilation of the project's files.
Parameters:
sourceDirectory - the source directory where stubs are stored.
classDirectory - the output directory, where stub binary files should be generated.
progress - monitor of the progress of the compilation.
Returns:
the success status.
removeCompiledResourceReceiver(ICompilatedResourceReceiver)
def removeCompiledResourceReceiver(ICompilatedResourceReceiver)
Remove a receiver on the successfully compiled resources.
Parameters:
receiver - the receiver.
Since:
0.6
removeIssueMessageListener(IssueMessageListener)
def removeIssueMessageListener(IssueMessageListener)
Add a listener on the issue messages.
Parameters:
listener - the listener.
Since:
0.6
reportCompilationIssues(Iterable<T>)
protected def reportCompilationIssues(Iterable<T>) : boolean
Output the given issues that result from the compilation of the SARL code.
Parameters:
issues - the issues to report.
Returns:
true if at least one error was reported, false if no error was reported.
reportInternalError(String,Object*)
protected def reportInternalError(String,Object*)
Reports the given error message.
Parameters:
message - the error message.
parameters - the values of the parameters that must be dynamically replaced within the message text.
Since:
0.8
reportInternalError(String,Throwable)
protected def reportInternalError(String,Throwable)
Reports the given error message.
Parameters:
message - the error message.
exception - the source of the exception.
Since:
0.8
reportInternalInfo(String,Object*)
protected def reportInternalInfo(String,Object*)
Reports the given information message.
Parameters:
message - the information message.
parameters - the values of the parameters that must be dynamically replaced within the message text.
Since:
0.12
reportInternalWarning(String)
protected def reportInternalWarning(String)
Reports the given warning message.
Parameters:
message - the warning message.
Since:
0.8
reportInternalWarning(String,Throwable)
protected def reportInternalWarning(String,Throwable)
Reports the given warning message.
Parameters:
message - the warning message.
exception - the source of the exception.
Since:
0.8
runJavaCompiler(File,Iterable<T>,Iterable<T>,Iterable<T>,boolean,boolean,IProgressMonitor)
protected def runJavaCompiler(File,Iterable<T>,Iterable<T>,Iterable<T>,boolean,boolean,IProgressMonitor) : CompilerStatus
Run the Java compiler.
Parameters:
classDirectory - the output directory.
sourcePathDirectories - the source directories.
classPathEntries - classpath entries.
modulePathEntries - classpath entries.
enableCompilerOutput - indicates if the Java compiler output is displayed.
enableOptimization - indicates if the Java compiler must applied optimization flags.
progress - monitor of the progress of the compilation.
Returns:
the success status.
See:
IJavaBatchCompiler
setAllWarningSeverities(Severity)
def setAllWarningSeverities(Severity)
Change the severity level of for all the warnings.
Parameters:
severity - the new severity. If null this function does nothing.
Since:
0.5
setBasePath(String)
def setBasePath(String)
Change the base path.
Parameters:
basePath - the base path.
setBaseURI(URI)
def setBaseURI(URI)
Change the base URI.
Parameters:
basePath - the base path.
setClassOutputPath(File)
def setClassOutputPath(File)
Set the path where the class files are generated.
Parameters:
path - the path; or null for ignoring the class generation.
setClassPath(String)
def setClassPath(String)
Change the classpath.

The classpath is a list the names of folders or jar files that are separated by pathSeparator.
Parameters:
classpath - the new classpath.
setClassPath(Collection<E>)
def setClassPath(Collection<E>)
Change the classpath.
Parameters:
classpath - the new classpath.
setCleaningPolicy(CleaningPolicy)
def setCleaningPolicy(CleaningPolicy)
Change the cleaning policy that is applied by this batch compiler.
Parameters:
policy - the cleaning policy. If it is null, the default policy is used.
Since:
0.10
setCurrentClassLoader(ClassLoader)
def setCurrentClassLoader(ClassLoader)
Set the current class loader.
Parameters:
loader - the new current class loader.
setDeleteTempDirectory(boolean)
def setDeleteTempDirectory(boolean)
Set if the temp folder must be deleted at the end of the compilation.
Parameters:
delete - true if the temp folder is deleted.
Deprecated:
since 0.10, see setCleaningPolicy(CleaningPolicy) .
setExtraLanguageGenerators(String)
def setExtraLanguageGenerators(String)
Change the extra languages' generators that should be enabled.
Parameters:
identifiers - the identifier, the identifiers (separated by pathSeparator of the extra languages' generator(s) to be enabled. If this parameter is null, all the extra languages' generator are disabled.
Since:
0.8
setFileEncoding(String)
def setFileEncoding(String)
Change the file encoding.
Parameters:
encoding - the encoding, usually UTF-8.
setGenerateCloneFunctions(boolean)
def setGenerateCloneFunctions(boolean)
Set if the clone functions shall be generated.
Parameters:
generateFunctions - true if the functions shall be generated.
Since:
0.8
setGeneratedAnnotationComment(String)
def setGeneratedAnnotationComment(String)
Set the comment in the @Generated annnotations.
Parameters:
comment - the comment.
setGenerateEqualityTestFunctions(boolean)
def setGenerateEqualityTestFunctions(boolean)
Set if the equality test functions shall be generated.
Parameters:
generateFunctions - true if the functions shall be generated.
Since:
0.8
setGenerateExpressions(boolean)
def setGenerateExpressions(boolean)
Set if the compiler generate the Xbase expressions.
Parameters:
generateExpressions - true if the compiler generates the expressions
setGenerateGeneratedAnnotation(boolean)
def setGenerateGeneratedAnnotation(boolean)
Set if the @Generated is generated.
Parameters:
generateAnnotations - true if the compiler generates the generated annotations.
setGenerateInlineAnnotation(boolean)
def setGenerateInlineAnnotation(boolean)
Set if the @Inline shall be generated.
Parameters:
generateInlineAnnotation - true if annotation shall be generated.
setGeneratePureAnnotation(boolean)
def setGeneratePureAnnotation(boolean)
Set if the @Pure shall be generated.
Parameters:
generatePureAnnotation - true if annotation shall be generated.
setGenerateSerialNumberFields(boolean)
def setGenerateSerialNumberFields(boolean)
Set if the serial number fields shall be generated.
Parameters:
generateFields - true if the fields shall be generated.
Since:
0.8
setGenerateSyntheticSuppressWarnings(boolean)
def setGenerateSyntheticSuppressWarnings(boolean)
Set if the @SuppressWarnings is generated.
Parameters:
generateAnnotations - true if the compiler generates the warning supression annotations.
setGenerateToStringFunctions(boolean)
def setGenerateToStringFunctions(boolean)
Set if the toString functions shall be generated.
Parameters:
generateFunctions - true if the functions shall be generated.
Since:
0.8
setIncludeDateInGeneratedAnnotation(boolean)
def setIncludeDateInGeneratedAnnotation(boolean)
Set if the generation date is included in the @Generated annotations.
Parameters:
includeDateInGeneratedAnnotation - true if the generation date is added.
setIssueComparator(Comparator<T>)
def setIssueComparator(Comparator<T>)
Set the comparator of issues that is used for sorting the issues before they are logged.
Parameters:
comparator - the comparator; never null.
setIssueMessageFormatter(IssueMessageFormatter)
def setIssueMessageFormatter(IssueMessageFormatter)
Set the formatter of the issue messages.
Parameters:
formatter - the formatter.
setJavaCompiler(IJavaBatchCompiler)
def setJavaCompiler(IJavaBatchCompiler)
Change the Java compiler.
Parameters:
compiler - the Java compiler
Since:
0.8
setJavaCompilerVerbose(boolean)
def setJavaCompilerVerbose(boolean)
Set the underlying Java compiler verbosity.
Parameters:
verbose - true if the Java compiler is verbose.
setJavaPostCompilationEnable(boolean)
def setJavaPostCompilationEnable(boolean)
Set if the Java compiler should be invoked after the SARL compiler is invoked.
Parameters:
enable - true if the Java compiler is invoked after the SARL compiler.
setJavaSourceVersion(String)
def setJavaSourceVersion(String)
Change the version of the Java source to be used for the generated Java files.
Parameters:
version - the Java version.
setLogger(Logger)
def setLogger(Logger)
Set the logger.
Parameters:
logger - the logger.
setModulePath(String)
def setModulePath(String)
Change the module-path. This function does nothing if the current version of Java is not supporting modules.

The module-path is a list the names of folders or jar files that are separated by pathSeparator.
Parameters:
modulepath - the new module-path.
Since:
0.12
setModulePath(Collection<E>)
def setModulePath(Collection<E>)
Change the module-path. This function does nothing if the current version of Java is not supporting modules.
Parameters:
modulepath - the new module-path.
Since:
0.12
setOptimizationLevel(OptimizationLevel)
def setOptimizationLevel(OptimizationLevel)
Change the optimization level that should be applied to the generated Java byte code.
Parameters:
level - the optimization level.
Since:
0.8
setOutputPath(File)
def setOutputPath(File)
Change the path where the Java files are generated.
Parameters:
path - the path, or null for using the default path in SARLConfig#FOLDER_SOURCE_GENERATED..
setOutputPath(String)
def setOutputPath(String)
Change the path where the Java files are generated.
Parameters:
path - the path.
setReportInternalProblemsAsIssues(boolean)
def setReportInternalProblemsAsIssues(boolean)
Change the flag that permits to report the compiler's internal problems as issues.
Parameters:
reportAsIssues - true if the internal errors are reported as issues.
Since:
0.8
See:
addIssueMessageListener(IssueMessageListener)
setReportWarningsAsErrors(boolean)
def setReportWarningsAsErrors(boolean)
Change the flag that permits to report the warning issues detected by the SARL compiler as errors to the user of the batch compiler.
Parameters:
reportAsErrors - true if the warnings are reported as errors.
Since:
0.13
See:
addIssueMessageListener(IssueMessageListener)
setResourceSetProvider(Provider<T>)
def setResourceSetProvider(Provider<T>)
Set the provider of resource sets.
Parameters:
resourceSetProvider - the provider.
setSarlCompilationEnable(boolean)
def setSarlCompilationEnable(boolean)
Set if the SARL compiler should be invoked before the Java compiler is invoked.
Parameters:
enable - is true if the SARL compiler is invoked before the Java compiler.
Since:
0.12
setSourcePath(String)
def setSourcePath(String)
Change the source path.

The source path is a list the names of folders that are separated by pathSeparator.
Parameters:
sourcePath - the new source path.
setSourcePath(Collection<E>)
def setSourcePath(Collection<E>)
Change the source path.
Parameters:
sourcePath - the new source path.
setTempDirectory(File)
def setTempDirectory(File)
Change the path where the Xtext stubs are generated.
Parameters:
path - the path.
setTempDirectory(String)
def setTempDirectory(String)
Change the path where the Xtext stubs are generated.
Parameters:
path - the path.
setUseCurrentClassLoaderAsParent(boolean)
def setUseCurrentClassLoaderAsParent(boolean)
Set if the class loaderr of this batch compiler must be used as sthe parent class loader.
Parameters:
useCurrentClassLoaderAsParent - true for using the class loader of this batch compiler.
setUseExpressionInterpreterForInlineAnnotation(boolean)
def setUseExpressionInterpreterForInlineAnnotation(boolean)
Set if the constant expression interpreter shall be called for generated @Inline.
Parameters:
generateInlineAnnotation - true if annotation shall be generated.
setWarningSeverity(String,Severity)
def setWarningSeverity(String,Severity)
Change the severity level of a warning.
Parameters:
warningId - the identifier of the warning. If null or empty, this function does nothing.
severity - the new severity. If null this function does nothing.
Since:
0.5
setWriteStorageFiles(boolean)
def setWriteStorageFiles(boolean)
Set if the storage files must be generated.

The storage files are binary versions of the resources in order to have faster reading/accessing.

The usual filename for the storage files follows the pattern .Type.sarlbin, where Type is the name of the SARL type declaration.
Parameters:
writeStorageFiles - true for generation.
setWriteTraceFiles(boolean)
def setWriteTraceFiles(boolean)
Set if the trace files must be generated.

A trace file contains the links between the class, java and SARL files. They are mandatory for retreiving and displaying the SARL source code from a JVM element.

The usual filename for the trace files follows the pattern .Type.java._trace, where Type is the name of the SARL type declaration.
Parameters:
writeTraceFiles - true for generation.
validate(ResourceSet,Collection<E>,IProgressMonitor)
protected def validate(ResourceSet,Collection<E>,IProgressMonitor) : java.util.List<E>
Generate the JVM model elements, and validate generated elements.
Parameters:
resourceSet - the container of the scripts.
validResources - will be filled by this function with the collection of resources that was successfully validated.
progress - monitor of the progress of the compilation.
Returns:
the list of the issues.