@SuppressWarnings({"static-method", "checkstyle:npathcomplexity"})
	@Provides
	@Singleton
	public SarlBatchCompiler provideSarlBatchCompiler(
			Injector injector, Provider<SarlConfig> config, Provider<SARLBootClasspathProvider> defaultBootClasspath,
			Provider<IssueMessageFormatter> issueMessageFormater,
			Provider<IJavaBatchCompiler> javaCompilerProvider) {
		final SarlConfig cfg = config.get();
		final CompilerConfig compilerConfig = cfg.getCompiler();
		final ValidatorConfig validatorConfig = cfg.getValidator();

		final SarlBatchCompiler compiler = new SarlBatchCompiler();
		injector.injectMembers(compiler);

		String fullClassPath = cfg.getBootClasspath();
		if (Strings.isEmpty(fullClassPath)) {
			fullClassPath = defaultBootClasspath.get().getClasspath();
		}

		final String userClassPath = cfg.getClasspath();
		if (!Strings.isEmpty(userClassPath) && !Strings.isEmpty(fullClassPath)) {
			fullClassPath = fullClassPath + File.pathSeparator + userClassPath;
		}
		compiler.setClassPath(fullClassPath);

		if (!Strings.isEmpty(cfg.getJavaBootClasspath())) {
			compiler.setBootClassPath(cfg.getJavaBootClasspath());
		}

		if (!Strings.isEmpty(compilerConfig.getFileEncoding())) {
			compiler.setFileEncoding(compilerConfig.getFileEncoding());
		}

		if (!Strings.isEmpty(compilerConfig.getJavaVersion())) {
			compiler.setJavaSourceVersion(compilerConfig.getJavaVersion());
		}

		final JavaCompiler jcompiler = compilerConfig.getJavaCompiler();
		compiler.setJavaPostCompilationEnable(jcompiler != JavaCompiler.NONE);
		compiler.setJavaCompiler(javaCompilerProvider.get());
		compiler.setOptimizationLevel(cfg.getCompiler().getOptimizationLevel());
		compiler.setWriteTraceFiles(compilerConfig.getOutputTraceFiles());
		compiler.setWriteStorageFiles(compilerConfig.getOutputTraceFiles());

		compiler.setGenerateInlineAnnotation(compilerConfig.getGenerateInlines());
		compiler.setUseExpressionInterpreterForInlineAnnotation(compilerConfig.getCompressInlineExpressions());
		compiler.setGeneratePureAnnotation(compilerConfig.getGeneratePures());
		compiler.setGenerateEqualityTestFunctions(compilerConfig.getGenerateEqualityTests());
		compiler.setGenerateToStringFunctions(compilerConfig.getGenerateToString());
		compiler.setGenerateCloneFunctions(compilerConfig.getGenerateClone());
		compiler.setGenerateSerialNumberFields(compilerConfig.getGenerateSerialIds());

		if (validatorConfig.getAllErrors()) {
			compiler.setAllWarningSeverities(Severity.ERROR);
		} else if (validatorConfig.getIgnoreWarnings()) {
			compiler.setAllWarningSeverities(Severity.IGNORE);
		}

		for (final Entry<String, Severity> entry : validatorConfig.getWarningLevels().entrySet()) {
			compiler.setWarningSeverity(entry.getKey(), entry.getValue());
		}

		compiler.setIssueMessageFormatter(issueMessageFormater.get());

		return compiler;
	}
@ SuppressWarnings ( { "static-method" , "checkstyle:npathcomplexity" } ) @ Provides @ Singleton public SarlBatchCompiler provideSarlBatchCompiler ( Injector injector , Provider < SarlConfig > config , Provider < SARLBootClasspathProvider > defaultBootClasspath , Provider < IssueMessageFormatter > issueMessageFormater , Provider < IJavaBatchCompiler > javaCompilerProvider ) { final SarlConfig cfg = config . get ( ) ; final CompilerConfig compilerConfig = cfg . getCompiler ( ) ; final ValidatorConfig validatorConfig = cfg . getValidator ( ) ; final SarlBatchCompiler compiler = new SarlBatchCompiler ( ) ; injector . injectMembers ( compiler ) ; String fullClassPath = cfg . getBootClasspath ( ) ; if ( Strings . isEmpty ( fullClassPath ) ) { fullClassPath = defaultBootClasspath . get ( ) . getClasspath ( ) ; } final String userClassPath = cfg . getClasspath ( ) ; if ( ! Strings . isEmpty ( userClassPath ) && ! Strings . isEmpty ( fullClassPath ) ) { fullClassPath = fullClassPath + File . pathSeparator + userClassPath ; } compiler . setClassPath ( fullClassPath ) ; if ( ! Strings . isEmpty ( cfg . getJavaBootClasspath ( ) ) ) { compiler . setBootClassPath ( cfg . getJavaBootClasspath ( ) ) ; } if ( ! Strings . isEmpty ( compilerConfig . getFileEncoding ( ) ) ) { compiler . setFileEncoding ( compilerConfig . getFileEncoding ( ) ) ; } if ( ! Strings . isEmpty ( compilerConfig . getJavaVersion ( ) ) ) { compiler . setJavaSourceVersion ( compilerConfig . getJavaVersion ( ) ) ; } final JavaCompiler jcompiler = compilerConfig . getJavaCompiler ( ) ; compiler . setJavaPostCompilationEnable ( jcompiler != JavaCompiler . NONE ) ; compiler . setJavaCompiler ( javaCompilerProvider . get ( ) ) ; compiler . setOptimizationLevel ( cfg . getCompiler ( ) . getOptimizationLevel ( ) ) ; compiler . setWriteTraceFiles ( compilerConfig . getOutputTraceFiles ( ) ) ; compiler . setWriteStorageFiles ( compilerConfig . getOutputTraceFiles ( ) ) ; compiler . setGenerateInlineAnnotation ( compilerConfig . getGenerateInlines ( ) ) ; compiler . setUseExpressionInterpreterForInlineAnnotation ( compilerConfig . getCompressInlineExpressions ( ) ) ; compiler . setGeneratePureAnnotation ( compilerConfig . getGeneratePures ( ) ) ; compiler . setGenerateEqualityTestFunctions ( compilerConfig . getGenerateEqualityTests ( ) ) ; compiler . setGenerateToStringFunctions ( compilerConfig . getGenerateToString ( ) ) ; compiler . setGenerateCloneFunctions ( compilerConfig . getGenerateClone ( ) ) ; compiler . setGenerateSerialNumberFields ( compilerConfig . getGenerateSerialIds ( ) ) ; if ( validatorConfig . getAllErrors ( ) ) { compiler . setAllWarningSeverities ( Severity . ERROR ) ; } else if ( validatorConfig . getIgnoreWarnings ( ) ) { compiler . setAllWarningSeverities ( Severity . IGNORE ) ; } for ( final Entry < String , Severity > entry : validatorConfig . getWarningLevels ( ) . entrySet ( ) ) { compiler . setWarningSeverity ( entry . getKey ( ) , entry . getValue ( ) ) ; } compiler . setIssueMessageFormatter ( issueMessageFormater . get ( ) ) ; return compiler ; }
Replies the SARL batch compiler.

@param injector the current injector.
@param config the configuration for the paths.
@param defaultBootClasspath the SARL boot class path that must be used by default.
@param issueMessageFormater the formatter of the issue messages.
@param javaCompilerProvider a provider of Java batch compiler.
@return the SARL batch compiler