List of usage examples for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants JDK1_2
long JDK1_2
To view the source code for org.eclipse.jdt.internal.compiler.classfmt ClassFileConstants JDK1_2.
Click Source Link
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 . jav a 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.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.java
License:Open Source License
private void addDefaultAbstractMethods() { if ((this.tagBits & TagBits.KnowsDefaultAbstractMethods) != 0) return;//from w w w . j av a 2 s. c om this.tagBits |= TagBits.KnowsDefaultAbstractMethods; if (isClass() && isAbstract()) { if (this.scope.compilerOptions().targetJDK >= ClassFileConstants.JDK1_2) return; // no longer added for post 1.2 targets ReferenceBinding[] itsInterfaces = superInterfaces(); if (itsInterfaces != Binding.NO_SUPERINTERFACES) { MethodBinding[] defaultAbstracts = null; int defaultAbstractsCount = 0; ReferenceBinding[] interfacesToVisit = itsInterfaces; int nextPosition = interfacesToVisit.length; for (int i = 0; i < nextPosition; i++) { ReferenceBinding superType = interfacesToVisit[i]; if (superType.isValidBinding()) { MethodBinding[] superMethods = superType.methods(); nextAbstractMethod: for (int m = superMethods.length; --m >= 0;) { MethodBinding method = superMethods[m]; // explicitly implemented ? if (implementsMethod(method)) continue nextAbstractMethod; if (defaultAbstractsCount == 0) { defaultAbstracts = new MethodBinding[5]; } else { // already added as default abstract ? for (int k = 0; k < defaultAbstractsCount; k++) { MethodBinding alreadyAdded = defaultAbstracts[k]; if (CharOperation.equals(alreadyAdded.selector, method.selector) && alreadyAdded.areParametersEqual(method)) continue nextAbstractMethod; } } MethodBinding defaultAbstract = new MethodBinding( method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | ClassFileConstants.AccSynthetic, method.selector, method.returnType, method.parameters, method.thrownExceptions, this); if (defaultAbstractsCount == defaultAbstracts.length) System.arraycopy(defaultAbstracts, 0, defaultAbstracts = new MethodBinding[2 * defaultAbstractsCount], 0, defaultAbstractsCount); defaultAbstracts[defaultAbstractsCount++] = defaultAbstract; } if ((itsInterfaces = superType.superInterfaces()) != Binding.NO_SUPERINTERFACES) { int itsLength = itsInterfaces.length; if (nextPosition + itsLength >= interfacesToVisit.length) System.arraycopy(interfacesToVisit, 0, interfacesToVisit = new ReferenceBinding[nextPosition + itsLength + 5], 0, nextPosition); nextInterface: for (int a = 0; a < itsLength; a++) { ReferenceBinding next = itsInterfaces[a]; for (int b = 0; b < nextPosition; b++) if (next == interfacesToVisit[b]) continue nextInterface; interfacesToVisit[nextPosition++] = next; } } } } if (defaultAbstractsCount > 0) { int length = this.methods.length; System.arraycopy(this.methods, 0, this.methods = new MethodBinding[length + defaultAbstractsCount], 0, length); System.arraycopy(defaultAbstracts, 0, this.methods, length, defaultAbstractsCount); // re-sort methods length = length + defaultAbstractsCount; if (length > 1) ReferenceBinding.sortMethods(this.methods, 0, length); // this.tagBits |= TagBits.AreMethodsSorted; -- already set in #methods() } } } }
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 ww.j av a2s . com } 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 w w. j a va 2 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; }