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

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

Introduction

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

Prototype

long JDK1_1

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

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;//w  w w. j ava  2  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:org.hibernate.eclipse.console.workbench.ProjectCompilerVersionChecker.java

License:Open Source License

private static long versionToJdkLevel(Object versionID) {
    if (versionID instanceof String) {
        String version = (String) versionID;
        // verification is optimized for all versions with same length and same "1." prefix
        if (version.length() == 3 && version.charAt(0) == '1' && version.charAt(1) == '.') {
            switch (version.charAt(2)) {
            case '1':
                return ClassFileConstants.JDK1_1;
            case '2':
                return ClassFileConstants.JDK1_2;
            case '3':
                return ClassFileConstants.JDK1_3;
            case '4':
                return ClassFileConstants.JDK1_4;
            case '5':
                return ClassFileConstants.JDK1_5;
            case '6':
                return ClassFileConstants.JDK1_6;
            case '7':
                return ClassFileConstants.JDK1_7;
            case '8':
                return ClassFileConstants.JDK1_8;
            default:
                return 0; // unknown
            }/*from  w  w  w. j a  v  a  2  s .co  m*/
        }
        if (VERSION_JSR14.equals(versionID)) {
            return ClassFileConstants.JDK1_4;
        }
        if (VERSION_CLDC1_1.equals(versionID)) {
            return ClassFileConstants.CLDC_1_1;
        }
    }
    return 0; // unknown
}

From source file:spoon.support.ByteCodeOutputProcessor.java

License:Open Source License

/**
 * Tells if the source is Java 1.4 or lower.
 *///from  w  ww  .j ava2  s . co m
public long getJavaCompliance() {
    switch (getFactory().getEnvironment().getComplianceLevel()) {
    case 1:
        return ClassFileConstants.JDK1_1;
    case 2:
        return ClassFileConstants.JDK1_2;
    case 3:
        return ClassFileConstants.JDK1_3;
    case 4:
        return ClassFileConstants.JDK1_4;
    case 5:
        return ClassFileConstants.JDK1_5;
    case 6:
        return ClassFileConstants.JDK1_6;
    }
    return ClassFileConstants.JDK1_5;
}