Example usage for org.eclipse.jdt.internal.compiler.impl CompilerOptions set

List of usage examples for org.eclipse.jdt.internal.compiler.impl CompilerOptions set

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.impl CompilerOptions set.

Prototype

public void set(Map<String, String> optionsMap) 

Source Link

Usage

From source file:br.com.objectos.code.JdtCompilerBuilderPojo.java

License:Apache License

@Override
public JdtCompiler build() {
    NameEnvironment environment = new NameEnvironment();
    IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.exitAfterAllProblems();
    CompilerOptions options = new CompilerOptions();
    options.set(optionMap.build());
    IProblemFactory problemFactory = ProblemFactory.getProblemFactory(Locale.getDefault());
    Compiler delegate = new Compiler(environment, policy, options, requestor, problemFactory);
    annotationProcessorManager.set(delegate);
    return new JdtCompiler(delegate);
}

From source file:lombok.RunTestsViaEcj.java

License:Open Source License

protected CompilerOptions ecjCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    options.complianceLevel = Eclipse.getLatestEcjCompilerVersionConstant();
    options.sourceLevel = Eclipse.getLatestEcjCompilerVersionConstant();
    options.targetJDK = Eclipse.getLatestEcjCompilerVersionConstant();
    options.docCommentSupport = false;/* w  w  w.  j av  a  2s  .  c o m*/
    options.parseLiteralExpressionsAsConstants = true;
    options.inlineJsrBytecode = true;
    options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
    options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false;
    options.reportUnusedDeclaredThrownExceptionWhenOverriding = false;
    options.reportUnusedParameterIncludeDocCommentReference = false;
    options.reportUnusedParameterWhenImplementingAbstract = false;
    options.reportUnusedParameterWhenOverridingConcrete = false;
    options.reportDeadCodeInTrivialIfStatement = false;
    options.generateClassFiles = false;
    Map<String, String> warnings = new HashMap<String, String>();
    warnings.put(CompilerOptions.OPTION_ReportUnusedLocal, "ignore");
    warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore");
    warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore");
    warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore");
    warnings.put(CompilerOptions.OPTION_Source, "1." + Eclipse.getEcjCompilerVersion());
    options.set(warnings);
    return options;
}

From source file:org.apache.sling.scripting.java.jdt.EclipseJavaCompiler.java

License:Apache License

private CompilerOptions getCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    final Map<String, String> settings = new HashMap<String, String>();
    settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
    settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
    settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE);
    settings.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.IGNORE);
    settings.put(CompilerOptions.OPTION_Encoding, this.compilerOptions.getJavaEncoding());
    if (this.compilerOptions.getClassDebugInfo()) {
        settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
    }/*from  w  ww  .jav  a  2  s. c  o m*/
    if (this.compilerOptions.getCompilerSourceVM().equals("1.6")) {
        settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
    } else {
        settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
    }
    if (this.compilerOptions.getCompilerTargetVM().equals("1.6")) {
        settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
        settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
    } else {
        settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
        settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
    }

    options.set(settings);
    return options;
}