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

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

Introduction

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

Prototype

String OPTION_Compliance

To view the source code for org.eclipse.jdt.internal.compiler.impl CompilerOptions OPTION_Compliance.

Click Source Link

Usage

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

License:Apache License

public void set(ImmutableMap.Builder<String, Object> optionMap) {
    optionMap.put(CompilerOptions.OPTION_TargetPlatform, version);
    optionMap.put(CompilerOptions.OPTION_Compliance, version);
    optionMap.put(CompilerOptions.OPTION_Source, version);
}

From source file:com.tsc9526.monalisa.plugin.eclipse.jdt.JDTCompiler.java

License:Open Source License

public CompilerOptions getCompilerOptions() {
    Map<String, String> settings = new HashMap<String, String>();
    settings.put(CompilerOptions.OPTION_ReportMissingSerialVersion, CompilerOptions.IGNORE);
    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, "UTF-8");
    settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
    String javaVersion = CompilerOptions.VERSION_1_6;

    if (System.getProperty("java.version").startsWith("1.5")) {
        javaVersion = CompilerOptions.VERSION_1_5;
    } else if (System.getProperty("java.version").startsWith("1.7")) {
        javaVersion = CompilerOptions.VERSION_1_7;
    } else if (System.getProperty("java.version").startsWith("1.8")) {
        javaVersion = CompilerOptions.VERSION_1_8;
    }/*from   w  ww .  j av  a2 s.  c  o m*/

    settings.put(CompilerOptions.OPTION_Source, javaVersion);
    settings.put(CompilerOptions.OPTION_TargetPlatform, javaVersion);
    settings.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE);
    settings.put(CompilerOptions.OPTION_Compliance, javaVersion);
    return new CompilerOptions(settings);
}

From source file:com.wavemaker.tools.compiler.WaveMakerJavaCompiler.java

License:Open Source License

@Override
@SuppressWarnings("unchecked")
public CompilationTask getTask(Writer out, JavaFileManager fileManager,
        DiagnosticListener<? super JavaFileObject> diagnosticListener, Iterable<String> options,
        Iterable<String> classes, Iterable<? extends JavaFileObject> compilationUnits) {

    if (fileManager == null) {
        fileManager = this.getStandardFileManager(diagnosticListener, null, null);
    }/*  w  w  w. j  av a 2s  .c  o m*/

    PrintWriter writer = createPrintWriter(out);

    EclipseBatchCompiler batchCompiler = new EclipseBatchCompiler(writer, writer, false);

    batchCompiler.options.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
    batchCompiler.options.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
    batchCompiler.options.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
    batchCompiler.diagnosticListener = diagnosticListener;
    batchCompiler.fileManager = fileManager;
    batchCompiler.setCompilationUnits(compilationUnits);

    if (options != null) {
        for (Iterator<String> iterator = options.iterator(); iterator.hasNext();) {
            batchCompiler.fileManager.handleOption(iterator.next(), iterator);
        }
    }
    batchCompiler.configure(getArgumentsForBatchCompiler(asList(options), asList(classes)));
    if (fileManager instanceof StandardJavaFileManager) {
        Iterable<? extends File> location = ((StandardJavaFileManager) fileManager)
                .getLocation(StandardLocation.CLASS_OUTPUT);
        if (location != null) {
            batchCompiler.setDestinationPath(location.iterator().next().getAbsolutePath());
        }
    }

    return new CompilationTaskImpl(batchCompiler);
}

From source file:com.xqbase.compiler.eclipse.EclipseJavaCompiler.java

License:Open Source License

public CompilerResult performCompile(CompilerConfiguration config) throws CompilerException {

    // added by xqbase-compiler-eclipse
    if (config.getGeneratedSourcesDirectory() != null) {
        config.getGeneratedSourcesDirectory().mkdirs();
    }//ww  w. ja  v a 2  s.  com

    List<CompilerMessage> errors = new LinkedList<CompilerMessage>();

    List<String> classpathEntries = config.getClasspathEntries();

    URL[] urls = new URL[1 + classpathEntries.size()];

    int i = 0;

    try {
        urls[i++] = new File(config.getOutputLocation()).toURL();

        for (String entry : classpathEntries) {
            urls[i++] = new File(entry).toURL();
        }
    } catch (MalformedURLException e) {
        throw new CompilerException("Error while converting the classpath entries to URLs.", e);
    }

    ClassLoader classLoader = new URLClassLoader(urls);

    SourceCodeLocator sourceCodeLocator = new SourceCodeLocator(config.getSourceLocations());

    INameEnvironment env = new EclipseCompilerINameEnvironment(sourceCodeLocator, classLoader, errors);

    IErrorHandlingPolicy policy = DefaultErrorHandlingPolicies.proceedWithAllProblems();

    // ----------------------------------------------------------------------
    // Build settings from configuration
    // ----------------------------------------------------------------------

    Map<String, String> settings = new HashMap<String, String>();

    if (config.isDebug()) {
        settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
        settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
        settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
    }

    if (!config.isShowWarnings()) {
        Map opts = new CompilerOptions().getMap();
        for (Object optKey : opts.keySet()) {
            if (opts.get(optKey).equals(CompilerOptions.WARNING)) {
                settings.put((String) optKey, CompilerOptions.IGNORE);
            }
        }
    }

    String sourceVersion = decodeVersion(config.getSourceVersion());

    if (sourceVersion != null) {
        settings.put(CompilerOptions.OPTION_Source, sourceVersion);
    }

    String targetVersion = decodeVersion(config.getTargetVersion());

    if (targetVersion != null) {
        settings.put(CompilerOptions.OPTION_TargetPlatform, targetVersion);

        if (config.isOptimize()) {
            settings.put(CompilerOptions.OPTION_Compliance, targetVersion);
        }
    }

    if (StringUtils.isNotEmpty(config.getSourceEncoding())) {
        settings.put(CompilerOptions.OPTION_Encoding, config.getSourceEncoding());
    }

    if (config.isShowDeprecation()) {
        settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING);
    } else {
        settings.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE);
    }

    // ----------------------------------------------------------------------
    // Set Eclipse-specific options
    // ----------------------------------------------------------------------

    settings.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
    settings.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);

    // compiler-specific extra options override anything else in the config object...
    Map<String, String> extras = config.getCustomCompilerArguments();
    if (extras != null && !extras.isEmpty()) {
        settings.putAll(extras);
    }

    if (settings.containsKey("-properties")) {
        initializeWarnings(settings.get("-properties"), settings);
        settings.remove("-properties");
    }

    IProblemFactory problemFactory = new DefaultProblemFactory(Locale.getDefault());

    ICompilerRequestor requestor = new EclipseCompilerICompilerRequestor(config.getOutputLocation(), errors);

    List<CompilationUnit> compilationUnits = new ArrayList<CompilationUnit>();

    for (String sourceRoot : config.getSourceLocations()) {
        Set<String> sources = getSourceFilesForSourceRoot(config, sourceRoot);

        for (String source : sources) {
            CompilationUnit unit = new CompilationUnit(source, makeClassName(source, sourceRoot), errors,
                    config.getSourceEncoding());

            compilationUnits.add(unit);
        }
    }

    // ----------------------------------------------------------------------
    // Compile!
    // ----------------------------------------------------------------------

    CompilerOptions options = new CompilerOptions(settings);
    Compiler compiler = new Compiler(env, policy, options, requestor, problemFactory);

    ICompilationUnit[] units = compilationUnits.toArray(new ICompilationUnit[compilationUnits.size()]);

    compiler.compile(units);

    CompilerResult compilerResult = new CompilerResult().compilerMessages(errors);

    for (CompilerMessage compilerMessage : errors) {
        if (compilerMessage.isError()) {
            compilerResult.setSuccess(false);
            continue;
        }
    }

    return compilerResult;
}

From source file:de.plugins.eclipse.depclipse.testcommons.TestingEnvironment.java

License:Open Source License

public IPath addProject(String projectName, String compliance) {
    checkAssertion("a workspace must be open", this.isOpen); //$NON-NLS-1$
    IProject project = createProject(projectName);
    String compilerVersion = null;
    compilerVersion = CompilerOptions.VERSION_1_6;
    IJavaProject javaProject = JavaCore.create(project);
    Map<String, String> options = new HashMap<String, String>();
    options.put(CompilerOptions.OPTION_Compliance, compilerVersion);
    options.put(CompilerOptions.OPTION_Source, compilerVersion);
    options.put(CompilerOptions.OPTION_TargetPlatform, compilerVersion);
    javaProject.setOptions(options);//w w w . j  a va 2s .  co  m
    return project.getFullPath();
}

From source file:io.gige.compiler.internal.CompilationTaskImpl.java

License:Apache License

protected Main parseOptions(PrintWriter out, Iterable<String> argv,
        Iterable<? extends JavaFileObject> compilationUnits) {
    Map<String, String> defaults = new HashMap<>();
    defaults.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8);
    defaults.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
    defaults.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8);

    Stream<String> files = Stream.concat(stream(argv.spliterator(), false),
            stream(compilationUnits.spliterator(), false).map(JavaFileObject::toUri)
                    .map(uri -> new File(uri).getAbsolutePath()));

    Main main = new Main(out, out, false, defaults, null);
    main.configure(files.toArray(String[]::new));
    return main;//from   w  ww  . j  a v a2 s.  c  o  m
}

From source file:io.takari.maven.plugins.compile.jdt.CompilerJdt.java

License:Open Source License

@Override
public int compile() throws MojoExecutionException, IOException {
    Map<String, String> args = new HashMap<String, String>();
    // XXX figure out how to reuse source/target check from jdt
    // org.eclipse.jdt.internal.compiler.batch.Main.validateOptions(boolean)
    args.put(CompilerOptions.OPTION_TargetPlatform, getTarget()); // support 5/6/7 aliases
    args.put(CompilerOptions.OPTION_Compliance, getTarget()); // support 5/6/7 aliases
    args.put(CompilerOptions.OPTION_Source, getSource()); // support 5/6/7 aliases
    args.put(CompilerOptions.OPTION_ReportForbiddenReference, CompilerOptions.ERROR);
    Set<Debug> debug = getDebug();
    if (debug == null || debug.contains(Debug.all)) {
        args.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
        args.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
        args.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
    } else if (debug.contains(Debug.none)) {
        args.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
        args.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
        args.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE);
    } else {//  w  w w . ja  v a2 s.co m
        args.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
        args.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
        args.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE);
        for (Debug keyword : debug) {
            switch (keyword) {
            case lines:
                args.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
                break;
            case source:
                args.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
                break;
            case vars:
                args.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
                break;
            default:
                throw new IllegalArgumentException();
            }
        }
    }

    class _CompilerOptions extends CompilerOptions {
        public void setShowWarnings(boolean showWarnings) {
            if (showWarnings) {
                warningThreshold = IrritantSet.COMPILER_DEFAULT_WARNINGS;
            } else {
                warningThreshold = new IrritantSet(0);
            }
        }
    }
    _CompilerOptions compilerOptions = new _CompilerOptions();

    compilerOptions.set(args);
    compilerOptions.performMethodsFullRecovery = false;
    compilerOptions.performStatementsRecovery = false;
    compilerOptions.verbose = isVerbose();
    compilerOptions.suppressWarnings = true;
    compilerOptions.setShowWarnings(isShowWarnings());
    compilerOptions.docCommentSupport = true;

    if (isProcEscalate() && strategy instanceof IncrementalCompilationStrategy) {
        strategy.enqueueAllSources();
        strategy = new FullCompilationStrategy();
    }

    Classpath namingEnvironment = strategy.createClasspath();
    IErrorHandlingPolicy errorHandlingPolicy = DefaultErrorHandlingPolicies.exitAfterAllProblems();
    IProblemFactory problemFactory = ProblemFactory.getProblemFactory(Locale.getDefault());
    Compiler compiler = new Compiler(namingEnvironment, errorHandlingPolicy, compilerOptions, this,
            problemFactory);
    compiler.options.produceReferenceInfo = true;

    EclipseFileManager fileManager = null;
    try {
        if (!isProcNone()) {
            fileManager = new EclipseFileManager(null, getSourceEncoding());
            fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, dependencies);
            fileManager.setLocation(StandardLocation.CLASS_OUTPUT, Collections.singleton(getOutputDirectory()));
            fileManager.setLocation(StandardLocation.SOURCE_OUTPUT,
                    Collections.singleton(getGeneratedSourcesDirectory()));

            ProcessingEnvImpl processingEnv = new ProcessingEnvImpl(context, fileManager,
                    getAnnotationProcessorOptions(), compiler, this);

            compiler.annotationProcessorManager = new AnnotationProcessorManager(processingEnv, fileManager,
                    getAnnotationProcessors());
            compiler.options.storeAnnotations = true;
        }

        return strategy.compile(namingEnvironment, compiler);
    } finally {
        if (fileManager != null) {
            fileManager.flush();
            fileManager.close();
        }
    }
}

From source file:jetbrick.template.compiler.JdtCompiler.java

License:Open Source License

private CompilerOptions getCompilerOptions() {
    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_Encoding, JavaSource.JAVA_FILE_ENCODING);
    settings.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
    settings.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
    settings.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
    settings.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);

    CompilerOptions options = new CompilerOptions(settings);
    options.parseLiteralExpressionsAsConstants = true;
    return options;
}

From source file:nz.ac.vuw.ecs.kcassell.GroovyTestProject.java

License:Apache License

public GroovyTestProject(String name) throws CoreException {
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    project = root.getProject(name);/*from   w ww. j a v a2  s.  c o  m*/
    project.create(null);
    project.open(null);
    javaProject = JavaCore.create(project);

    IFolder binFolder = createBinFolder();

    setJavaNature();
    javaProject.setRawClasspath(new IClasspathEntry[0], null);

    createOutputFolder(binFolder);
    sourceFolder = createSourceFolder();
    //        addSystemLibraries();

    javaProject.setOption(CompilerOptions.OPTION_Compliance, "1.5");
    javaProject.setOption(CompilerOptions.OPTION_Source, "1.5");
    javaProject.setOption(CompilerOptions.OPTION_TargetPlatform, "1.5");
}

From source file:org.ant4eclipse.ant.jdt.ecj.CompilerOptionsProvider.java

License:Open Source License

/**
 * <p>/*from www  .j a va  2  s .c  o m*/
 * Returns the compiler options specified in the javac task.
 * </p>
 * 
 * @param javac
 *          the javac task
 * @return the compiler options specified in the javac task.
 */
@SuppressWarnings("unchecked")
private static final StringMap getJavacCompilerOptions(Javac javac) {

    StringMap result = new StringMap();

    /*
     * set the source option
     */
    if (Utilities.hasText(javac.getSource())) {

        // get the source
        String source = javac.getSource();
        // set the source
        if (source.equals("1.3")) {
            result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_3);
        } else if (source.equals("1.4")) {
            result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
        } else if (source.equals("1.5") || source.equals("5") || source.equals("5.0")) {
            result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
        } else if (source.equals("1.6") || source.equals("6") || source.equals("6.0")) {
            result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_6);
        } else if (source.equals("1.7") || source.equals("7") || source.equals("7.0")) {
            result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_7);
        } else if (source.equals("1.8") || source.equals("8") || source.equals("8.0")) {
            result.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_8);
        } else {
            throw new Ant4EclipseException(EcjExceptionCodes.UNKNOWN_JAVA_SOURCE_OPTION_EXCEPTION, source);
        }
    }

    /*
     * set the target option
     */
    if (Utilities.hasText(javac.getTarget())) {

        // get the target
        String target = javac.getTarget();

        // set the target
        if (target.equals("1.3")) {
            result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_3);
            result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_3);
        } else if (target.equals("1.4")) {
            result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_4);
            result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
        } else if (target.equals("1.5") || target.equals("5") || target.equals("5.0")) {
            result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_5);
            result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
        } else if (target.equals("1.6") || target.equals("6") || target.equals("6.0")) {
            result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_6);
            result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_6);
        } else if (target.equals("1.7") || target.equals("7") || target.equals("7.0")) {
            result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_7);
            result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_7);
        } else if (target.equals("1.8") || target.equals("8") || target.equals("8.0")) {
            result.put(CompilerOptions.OPTION_TargetPlatform, CompilerOptions.VERSION_1_8);
            result.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_8);
        } else {
            throw new Ant4EclipseException(EcjExceptionCodes.UNKNOWN_JAVA_TARGET_OPTION_EXCEPTION, target);
        }
    }

    /*
     * set the debug options
     */
    if (javac.getDebug()) {

        String debugLevel = javac.getDebugLevel();

        if (debugLevel != null) {
            result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
            result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
            result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE);
            if (debugLevel.length() != 0) {
                if (debugLevel.indexOf("vars") != -1) {
                    result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
                }
                if (debugLevel.indexOf("lines") != -1) {
                    result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
                }
                if (debugLevel.indexOf("source") != -1) {
                    result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
                }
            }
        } else {
            result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
            result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
            result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.GENERATE);
        }
    } else {
        result.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
        result.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
        result.put(CompilerOptions.OPTION_SourceFileAttribute, CompilerOptions.DO_NOT_GENERATE);
    }

    /*
     * Handle the nowarn option. If none, then we generate all warnings.
     */
    if (javac.getNowarn()) {
        // disable all warnings
        Map.Entry<String, String>[] entries = result.entrySet().toArray(new Map.Entry[result.size()]);
        for (Entry<String, String> entrie : entries) {
            Map.Entry<String, String> entry = entrie;
            if (entry.getValue().equals(CompilerOptions.WARNING)) {
                result.put(entry.getKey(), CompilerOptions.IGNORE);
            }
        }
        result.put(CompilerOptions.OPTION_TaskTags, Util.EMPTY_STRING);
        if (javac.getDeprecation()) {
            result.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING);
            result.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ENABLED);
            result.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod,
                    CompilerOptions.ENABLED);
        }
    } else if (javac.getDeprecation()) {
        result.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.WARNING);
        result.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.ENABLED);
        result.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod,
                CompilerOptions.ENABLED);
    } else {
        result.put(CompilerOptions.OPTION_ReportDeprecation, CompilerOptions.IGNORE);
        result.put(CompilerOptions.OPTION_ReportDeprecationInDeprecatedCode, CompilerOptions.DISABLED);
        result.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod,
                CompilerOptions.DISABLED);
    }

    /*
     * set the encoding option
     */
    if (javac.getEncoding() != null) {
        result.put(CompilerOptions.OPTION_Encoding, javac.getEncoding());
    }

    // return result
    return result;
}