Example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants JDK1_6

List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants JDK1_6

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants JDK1_6.

Prototype

long JDK1_6

To view the source code for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants JDK1_6.

Click Source Link

Usage

From source file:ch.uzh.ifi.seal.changedistiller.ast.java.JavaASTHelper.java

License:Apache License

@Inject
JavaASTHelper(@Assisted File file, @Assisted String javaVersion, JavaASTNodeTypeConverter astHelper,
        JavaDeclarationConverter declarationConverter, JavaMethodBodyConverter bodyConverter) {
    long versionNumber;
    switch (javaVersion) {
    case "1.1":
        versionNumber = ClassFileConstants.JDK1_1;
        break;/*from   ww w. j  a va2 s. c o  m*/
    case "1.2":
        versionNumber = ClassFileConstants.JDK1_2;
        break;
    case "1.3":
        versionNumber = ClassFileConstants.JDK1_3;
        break;
    case "1.4":
        versionNumber = ClassFileConstants.JDK1_4;
        break;
    case "1.5":
        versionNumber = ClassFileConstants.JDK1_5;
        break;
    case "1.6":
        versionNumber = ClassFileConstants.JDK1_6;
        break;
    case "1.7":
        versionNumber = ClassFileConstants.JDK1_7;
        break;
    default:
        versionNumber = ClassFileConstants.JDK1_7;
    }
    fCompilation = JavaCompilationUtils.compile(file, versionNumber);
    prepareComments();
    fASTHelper = astHelper;
    fDeclarationConverter = declarationConverter;
    fBodyConverter = bodyConverter;
}

From source file:ch.uzh.ifi.seal.changedistiller.ast.java.JavaCompilationUtils.java

License:Apache License

private static CompilerOptions getDefaultCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    options.docCommentSupport = true;/*from w  w  w.  j  a v a  2  s.  c om*/
    options.complianceLevel = ClassFileConstants.JDK1_6;
    options.sourceLevel = ClassFileConstants.JDK1_6;
    options.targetJDK = ClassFileConstants.JDK1_6;
    return options;
}

From source file:com.android.tools.lint.EcjParser.java

License:Apache License

public static long getLanguageLevel(int major, int minor) {
    assert major == 1;
    switch (minor) {
    case 5://from  w  w  w  . j  av  a  2 s  . co m
        return ClassFileConstants.JDK1_5;
    case 6:
        return ClassFileConstants.JDK1_6;
    case 7:
    default:
        return ClassFileConstants.JDK1_7;
    }
}

From source file:com.android.tools.lint.psi.EcjPsiManager.java

License:Apache License

@NonNull
private static LanguageLevel toLanguageLevel(long ecjLanguageLevel) {
    if (ecjLanguageLevel == ClassFileConstants.JDK1_7) {
        return LanguageLevel.JDK_1_7;
    }/*from   www  . j av  a  2 s  . c  o  m*/
    if (ecjLanguageLevel == ClassFileConstants.JDK1_6) {
        return LanguageLevel.JDK_1_6;
    }
    if (ecjLanguageLevel == ClassFileConstants.JDK1_8) {
        return LanguageLevel.JDK_1_8;
    }
    if (ecjLanguageLevel == ClassFileConstants.JDK1_5) {
        return LanguageLevel.JDK_1_5;
    }

    return LanguageLevel.JDK_1_7;
}

From source file:com.google.gwt.dev.javac.JdtCompiler.java

License:Open Source License

public static CompilerOptions getCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    options.complianceLevel = options.sourceLevel = options.targetJDK = ClassFileConstants.JDK1_6;

    // Generate debug info for debugging the output.
    options.produceDebugAttributes = ClassFileConstants.ATTR_VARS | ClassFileConstants.ATTR_LINES
            | ClassFileConstants.ATTR_SOURCE;
    // Tricks like "boolean stopHere = true;" depend on this setting.
    options.preserveAllLocalVariables = true;

    // Turn off all warnings, saves some memory / speed.
    options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false;
    options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
    // Instantiations    options.warningThreshold = 0;
    options.inlineJsrBytecode = true;/*from w  ww . j  a  v a2s.  c  o m*/
    return options;
}

From source file:fr.inria.astor.core.manipulation.compiler.bytecode.JDTByteCodeCompiler.java

License:Open Source License

public CompilerOptions getCompilerOption() {
    if (compilerOption == null) {
        compilerOption = new CompilerOptions();
        compilerOption.sourceLevel = ClassFileConstants.JDK1_6;//ClassFileConstants.JDK1_5;
        compilerOption.suppressWarnings = true;

        ///*from ww w  .  j av  a 2  s  .c om*/

        compilerOption.targetJDK = ClassFileConstants.JDK1_6; //was 6

        compilerOption.produceDebugAttributes = ClassFileConstants.ATTR_SOURCE | ClassFileConstants.ATTR_LINES
                | ClassFileConstants.ATTR_VARS;
        compilerOption.preserveAllLocalVariables = true;
        compilerOption.inlineJsrBytecode = true;

        //MM
        compilerOption.tolerateIllegalAmbiguousVarargsInvocation = true;
    }
    return compilerOption;
}

From source file:lombok.ast.app.Main.java

License:Open Source License

protected CompilerOptions ecjCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    options.complianceLevel = ClassFileConstants.JDK1_6;
    options.sourceLevel = ClassFileConstants.JDK1_6;
    options.targetJDK = ClassFileConstants.JDK1_6;
    options.parseLiteralExpressionsAsConstants = true;
    return options;
}

From source file:lombok.eclipse.Eclipse.java

License:Open Source License

public static long getLatestEcjCompilerVersionConstant() {
    if (latestEcjCompilerVersionConstantCached != 0)
        return latestEcjCompilerVersionConstantCached;

    int highestVersionSoFar = 0;
    for (Field f : ClassFileConstants.class.getDeclaredFields()) {
        try {/*from  w  w  w . j  a  v a  2  s . co  m*/
            if (f.getName().startsWith("JDK1_")) {
                int thisVersion = Integer.parseInt(f.getName().substring("JDK1_".length()));
                if (thisVersion > highestVersionSoFar) {
                    highestVersionSoFar = thisVersion;
                    latestEcjCompilerVersionConstantCached = (Long) f.get(null);
                }
            }
        } catch (Exception ignore) {
        }
    }

    if (highestVersionSoFar > 6 && !ecjSupportsJava7Features()) {
        latestEcjCompilerVersionConstantCached = ClassFileConstants.JDK1_6;
    }
    return latestEcjCompilerVersionConstantCached;
}

From source file:lombok.RunTestsViaEclipse.java

License:Open Source License

protected static CompilerOptions ecjCompilerOptions() {
    CompilerOptions options = new CompilerOptions();
    options.complianceLevel = ClassFileConstants.JDK1_6;
    options.sourceLevel = ClassFileConstants.JDK1_6;
    options.targetJDK = ClassFileConstants.JDK1_6;
    options.parseLiteralExpressionsAsConstants = true;
    return options;
}

From source file:net.sf.j2s.core.builder.AbstractImageBuilder.java

License:Open Source License

protected Compiler newCompiler() {
    // disable entire javadoc support if not interested in diagnostics
    Map projectOptions = this.javaBuilder.javaProject.getOptions(true);
    String option = (String) projectOptions.get(JavaCore.COMPILER_PB_INVALID_JAVADOC);
    if (option == null || option.equals(JavaCore.IGNORE)) { // TODO (frederic) see why option is null sometimes while running model tests!?
        option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_TAGS);
        if (option == null || option.equals(JavaCore.IGNORE)) {
            option = (String) projectOptions.get(JavaCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS);
            if (option == null || option.equals(JavaCore.IGNORE)) {
                option = (String) projectOptions.get(JavaCore.COMPILER_PB_UNUSED_IMPORT);
                if (option == null || option.equals(JavaCore.IGNORE)) { // Unused import need also to look inside javadoc comment
                    projectOptions.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.DISABLED);
                }//from   ww w . j a va2 s  . c o  m
            }
        }
    }

    // called once when the builder is initialized... can override if needed
    CompilerOptions compilerOptions = new CompilerOptions(projectOptions);
    compilerOptions.performMethodsFullRecovery = true;
    compilerOptions.performStatementsRecovery = true;
    Compiler newCompiler = new Compiler(this.nameEnvironment,
            DefaultErrorHandlingPolicies.proceedWithAllProblems(), compilerOptions, this,
            ProblemFactory.getProblemFactory(Locale.getDefault()));
    CompilerOptions options = newCompiler.options;
    // temporary code to allow the compiler to revert to a single thread
    String setting = System.getProperty("jdt.compiler.useSingleThread"); //$NON-NLS-1$
    newCompiler.useSingleThread = setting != null && setting.equals("true"); //$NON-NLS-1$

    // enable the compiler reference info support
    options.produceReferenceInfo = true;

    if (options.complianceLevel >= ClassFileConstants.JDK1_6 && options.processAnnotations) {
        // support for Java 6 annotation processors
        initializeAnnotationProcessorManager(newCompiler);
    }

    return newCompiler;
}