diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 988d9c4d826..6027a94bfd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,7 +35,7 @@ jobs: maven-version: 3.9.3 - name: Build with Maven 🏗️ run: | - mvn clean install -f org.eclipse.jdt.core.compiler.batch -DlocalEcjVersion=99.99 && mvn -U clean verify --batch-mode --fail-at-end -Ptest-on-javase-20 -Pbree-libs -Papi-check -Djava.io.tmpdir=$WORKSPACE/tmp -Dproject.build.sourceEncoding=UTF-8 -Dtycho.surefire.argLine="--add-modules ALL-SYSTEM -Dcompliance=1.8,11,17,20 -Djdt.performance.asserts=disabled" -Dcbi-ecj-version=99.99 + mvn clean install -f org.eclipse.jdt.core.compiler.batch -DlocalEcjVersion=99.99 && mvn -U clean verify --batch-mode --fail-at-end -Ptest-on-javase-20 -Pbree-libs -Papi-check -Djava.io.tmpdir=$WORKSPACE/tmp -Dproject.build.sourceEncoding=UTF-8 -Dtycho.surefire.argLine="--add-modules ALL-SYSTEM --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -Dcompliance=1.8,11,17,20 -Djdt.performance.asserts=disabled" -Dcbi-ecj-version=99.99 env: MAVEN_OPTS: --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED JAVA_OPTS: --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED diff --git a/Jenkinsfile b/Jenkinsfile index b151adcb59b..29975e5035e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -38,7 +38,7 @@ pipeline { mvn -U clean verify --batch-mode --fail-at-end -Dmaven.repo.local=$WORKSPACE/.m2/repository \ -Ptest-on-javase-20 -Pbree-libs -Papi-check \ -Djava.io.tmpdir=$WORKSPACE/tmp -Dproject.build.sourceEncoding=UTF-8 \ - -Dtycho.surefire.argLine="--add-modules ALL-SYSTEM --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED -Dcompliance=1.8,11,17,20 -Djdt.performance.asserts=disabled" \ + -Dtycho.surefire.argLine="--add-modules ALL-SYSTEM --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED -Dcompliance=1.8,11,17,20 -Djdt.performance.asserts=disabled" \ -Dcbi-ecj-version=99.99 """ } diff --git a/org.eclipse.jdt.compiler.apt.tests/pom.xml b/org.eclipse.jdt.compiler.apt.tests/pom.xml index a2f7964e523..699f43a8d7f 100644 --- a/org.eclipse.jdt.compiler.apt.tests/pom.xml +++ b/org.eclipse.jdt.compiler.apt.tests/pom.xml @@ -27,4 +27,23 @@ org.eclipse.jdt.compiler.apt.tests.AllTests + + + + org.eclipse.tycho + tycho-compiler-plugin + + false + + + --add-exports + jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + --add-exports + jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED + + + + + + diff --git a/org.eclipse.jdt.compiler.tool.tests/pom.xml b/org.eclipse.jdt.compiler.tool.tests/pom.xml index 0b0c57b3dab..882d301d755 100644 --- a/org.eclipse.jdt.compiler.tool.tests/pom.xml +++ b/org.eclipse.jdt.compiler.tool.tests/pom.xml @@ -43,6 +43,8 @@ false + --add-exports + jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED diff --git a/org.eclipse.jdt.core.compiler.batch/.classpath b/org.eclipse.jdt.core.compiler.batch/.classpath index 09b15eb85ed..948d558f5ff 100644 --- a/org.eclipse.jdt.core.compiler.batch/.classpath +++ b/org.eclipse.jdt.core.compiler.batch/.classpath @@ -3,7 +3,7 @@ - + diff --git a/org.eclipse.jdt.core.compiler.batch/pom.xml b/org.eclipse.jdt.core.compiler.batch/pom.xml index dd324e1311e..e3622ede05c 100644 --- a/org.eclipse.jdt.core.compiler.batch/pom.xml +++ b/org.eclipse.jdt.core.compiler.batch/pom.xml @@ -35,6 +35,8 @@ false + --add-exports + jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java index 033a106fa1f..82daf78f734 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/core/JDTCompilerAdapter.java @@ -31,8 +31,8 @@ import org.apache.tools.ant.taskdefs.Javac; import org.apache.tools.ant.taskdefs.compilers.DefaultCompilerAdapter; import org.apache.tools.ant.types.Commandline; -import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.Commandline.Argument; +import org.apache.tools.ant.types.Path; import org.apache.tools.ant.util.JavaEnvUtils; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.antadapter.AntAdapterMessages; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java index 87fea9edbf8..062ce3fd2f6 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ClassFile.java @@ -127,6 +127,7 @@ import org.eclipse.jdt.internal.compiler.util.Messages; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; /** @@ -270,7 +271,7 @@ private static void createProblemType(TypeDeclaration typeDeclaration, ClassFile MethodBinding method = methodDecl.binding; if (method == null) continue; if (abstractMethodsOnly) { - method.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract; + method.modifiers = Flags.PUBLIC | Flags.ABSTRACT; } if (method.isConstructor()) { if (typeBinding.isInterface()) continue; @@ -725,7 +726,7 @@ private void addFieldInfo(FieldBinding fieldBinding) { int accessFlags = fieldBinding.getAccessFlags(); if (this.targetJDK < ClassFileConstants.JDK1_5) { // pre 1.5, synthetic was an attribute, not a modifier - accessFlags &= ~ClassFileConstants.AccSynthetic; + accessFlags &= ~Flags.SYNTHETIC; } this.contents[this.contentsOffset++] = (byte) (accessFlags >> 8); this.contents[this.contentsOffset++] = (byte) accessFlags; @@ -795,7 +796,7 @@ public void addFieldInfos() { private void addMissingAbstractProblemMethod(MethodDeclaration methodDeclaration, MethodBinding methodBinding, CategorizedProblem problem, CompilationResult compilationResult) { // always clear the strictfp/native/abstract bit for a problem method - generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); + generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(Flags.STRICTFP | Flags.NATIVE | Flags.ABSTRACT)); int methodAttributeOffset = this.contentsOffset; int attributeNumber = generateMethodInfoAttributes(methodBinding); @@ -899,7 +900,7 @@ public void addProblemConstructor( } // always clear the strictfp/native/abstract bit for a problem method - generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); + generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(Flags.STRICTFP | Flags.NATIVE | Flags.ABSTRACT)); int methodAttributeOffset = this.contentsOffset; int attributesNumber = generateMethodInfoAttributes(methodBinding); @@ -982,7 +983,7 @@ public void addProblemMethod( method.abort(ProblemSeverities.AbortType, null); } // always clear the strictfp/native/abstract bit for a problem method - generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(ClassFileConstants.AccStrictfp | ClassFileConstants.AccNative | ClassFileConstants.AccAbstract)); + generateMethodInfoHeader(methodBinding, methodBinding.modifiers & ~(Flags.STRICTFP | Flags.NATIVE | Flags.ABSTRACT)); int methodAttributeOffset = this.contentsOffset; int attributesNumber = generateMethodInfoAttributes(methodBinding); @@ -2996,7 +2997,7 @@ private int generateModuleAttribute(ModuleDeclaration module) { this.constantPool.literalIndexForModule(binding.moduleName); this.contents[localContentsOffset++] = (byte) (moduleNameIndex >> 8); this.contents[localContentsOffset++] = (byte) moduleNameIndex; - int flags = module.modifiers & ~(ClassFileConstants.AccModule); + int flags = module.modifiers & ~(Flags.ACC_MODULE); this.contents[localContentsOffset++] = (byte) (flags >> 8); this.contents[localContentsOffset++] = (byte) flags; String moduleVersion = module.getModuleVersion(); @@ -3044,7 +3045,7 @@ private int generateModuleAttribute(ModuleDeclaration module) { int javabase_index = this.constantPool.literalIndexForModule(javaBaseBinding.moduleName); this.contents[localContentsOffset++] = (byte) (javabase_index >> 8); this.contents[localContentsOffset++] = (byte) (javabase_index); - flags = ClassFileConstants.AccMandated; + flags = Flags.MANDATED; this.contents[localContentsOffset++] = (byte) (flags >> 8); this.contents[localContentsOffset++] = (byte) flags; int required_version = 0; @@ -3587,9 +3588,9 @@ private int generateInnerClassAttribute(int numberOfInnerClasses, ReferenceBindi if (innerClass.isAnonymousType()) { ReferenceBinding superClass = innerClass.superclass(); if (superClass == null || !(superClass.isEnum() && superClass.isSealed())) - accessFlags &= ~ClassFileConstants.AccFinal; + accessFlags &= ~Flags.FINAL; } else if (innerClass.isMemberType() && innerClass.isInterface()) { - accessFlags |= ClassFileConstants.AccStatic; // implicitely static + accessFlags |= Flags.STATIC; // implicitely static } this.contents[localContentsOffset++] = (byte) (accessFlags >> 8); this.contents[localContentsOffset++] = (byte) accessFlags; @@ -4428,13 +4429,13 @@ public void generateMethodInfoHeader(MethodBinding methodBinding, int accessFlag if (this.targetJDK < ClassFileConstants.JDK1_5) { // pre 1.5, synthetic is an attribute, not a modifier // pre 1.5, varargs is an attribute, not a modifier (-target jsr14 mode) - accessFlags &= ~(ClassFileConstants.AccSynthetic | ClassFileConstants.AccVarargs); + accessFlags &= ~(Flags.SYNTHETIC | Flags.ACC_VARARGS); } if ((methodBinding.tagBits & TagBits.ClearPrivateModifier) != 0) { - accessFlags &= ~ClassFileConstants.AccPrivate; + accessFlags &= ~Flags.PRIVATE; } if (this.targetJDK >= ClassFileConstants.JDK17) { - accessFlags &= ~(ClassFileConstants.AccStrictfp); + accessFlags &= ~(Flags.STRICTFP); } this.contents[this.contentsOffset++] = (byte) (accessFlags >> 8); this.contents[this.contentsOffset++] = (byte) accessFlags; @@ -4489,8 +4490,8 @@ public void generateMethodInfoHeaderForClinit() { if (this.contentsOffset + 10 >= this.contents.length) { resizeContents(10); } - this.contents[this.contentsOffset++] = (byte) ((ClassFileConstants.AccDefault | ClassFileConstants.AccStatic) >> 8); - this.contents[this.contentsOffset++] = (byte) (ClassFileConstants.AccDefault | ClassFileConstants.AccStatic); + this.contents[this.contentsOffset++] = (byte) ((0 | Flags.STATIC) >> 8); + this.contents[this.contentsOffset++] = (byte) (0 | Flags.STATIC); int nameIndex = this.constantPool.literalIndex(ConstantPool.Clinit); this.contents[this.contentsOffset++] = (byte) (nameIndex >> 8); this.contents[this.contentsOffset++] = (byte) nameIndex; @@ -4988,11 +4989,11 @@ private int generateMethodParameters(final MethodBinding binding) { if (declaringClass.isEnum()) { if (isConstructor) { // insert String name,int ordinal - length = writeArgumentName(ConstantPool.EnumName, ClassFileConstants.AccSynthetic, length); - length = writeArgumentName(ConstantPool.EnumOrdinal, ClassFileConstants.AccSynthetic, length); + length = writeArgumentName(ConstantPool.EnumName, Flags.SYNTHETIC, length); + length = writeArgumentName(ConstantPool.EnumOrdinal, Flags.SYNTHETIC, length); } else if (binding instanceof SyntheticMethodBinding && CharOperation.equals(ConstantPool.ValueOf, binding.selector)) { // insert String name - length = writeArgumentName(ConstantPool.Name, ClassFileConstants.AccMandated, length); + length = writeArgumentName(ConstantPool.Name, Flags.MANDATED, length); targetParameters = Binding.NO_PARAMETERS; // Override "unknown" synthetics below } } @@ -5012,11 +5013,11 @@ private int generateMethodParameters(final MethodBinding binding) { // isn't the first. The practical relevance of this is questionable, since the constructor call will be // generated by the same constructor. boolean couldForwardToMandated = anonymousWithNestedSuper ? declaringClass.superclass().enclosingType().equals(syntheticArgumentTypes[i]) : true; - int modifier = couldForwardToMandated && isImplicitlyDeclared ? ClassFileConstants.AccMandated : ClassFileConstants.AccSynthetic; + int modifier = couldForwardToMandated && isImplicitlyDeclared ? Flags.MANDATED : Flags.SYNTHETIC; char[] name = CharOperation.concat( TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, String.valueOf(i).toCharArray()); // cannot use depth, can be identical - length = writeArgumentName(name, modifier | ClassFileConstants.AccFinal, length); + length = writeArgumentName(name, modifier | Flags.FINAL, length); } } if (binding instanceof SyntheticMethodBinding) { @@ -5034,7 +5035,7 @@ private int generateMethodParameters(final MethodBinding binding) { Argument argument = arguments[i]; length = writeArgumentName(argument.name, argument.binding.modifiers, length); } else { - length = writeArgumentName(null, ClassFileConstants.AccSynthetic, length); + length = writeArgumentName(null, Flags.SYNTHETIC, length); } } } @@ -5042,12 +5043,12 @@ private int generateMethodParameters(final MethodBinding binding) { SyntheticArgumentBinding[] syntheticOuterArguments = declaringClass.syntheticOuterLocalVariables(); int count = syntheticOuterArguments == null ? 0 : syntheticOuterArguments.length; for (int i = 0; i < count; i++) { - length = writeArgumentName(syntheticOuterArguments[i].name, syntheticOuterArguments[i].modifiers | ClassFileConstants.AccSynthetic, length); + length = writeArgumentName(syntheticOuterArguments[i].name, syntheticOuterArguments[i].modifiers | Flags.SYNTHETIC, length); } // move the extra padding arguments of the synthetic constructor invocation to the end for (int i = targetParameters.length, extraLength = binding.parameters.length; i < extraLength; i++) { TypeBinding parameter = binding.parameters[i]; - length = writeArgumentName(parameter.constantPoolName(), ClassFileConstants.AccSynthetic, length); + length = writeArgumentName(parameter.constantPoolName(), Flags.SYNTHETIC, length); } } @@ -5084,7 +5085,7 @@ private int writeArgumentName(char[] name, int modifiers, int oldLength) { int parameterNameIndex = name == null ? 0 : this.constantPool.literalIndex(name); this.contents[this.contentsOffset++] = (byte) (parameterNameIndex >> 8); this.contents[this.contentsOffset++] = (byte) parameterNameIndex; - int flags = modifiers & (ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic | ClassFileConstants.AccMandated); + int flags = modifiers & (Flags.FINAL | Flags.SYNTHETIC | Flags.MANDATED); this.contents[this.contentsOffset++] = (byte) (flags >> 8); this.contents[this.contentsOffset++] = (byte) flags; return oldLength + 1; @@ -5913,31 +5914,31 @@ public void initialize(SourceTypeBinding aType, ClassFile parentClassFile, boole // Modifier manipulations for classfile int accessFlags = aType.getAccessFlags(); if (aType.isPrivate()) { // rewrite private to non-public - accessFlags &= ~ClassFileConstants.AccPublic; + accessFlags &= ~Flags.PUBLIC; } if (aType.isProtected()) { // rewrite protected into public - accessFlags |= ClassFileConstants.AccPublic; + accessFlags |= Flags.PUBLIC; } // clear all bits that are illegal for a class or an interface accessFlags &= ~( - ClassFileConstants.AccStrictfp - | ClassFileConstants.AccProtected - | ClassFileConstants.AccPrivate - | ClassFileConstants.AccStatic - | ClassFileConstants.AccSynchronized - | ClassFileConstants.AccNative); + Flags.STRICTFP + | Flags.PROTECTED + | Flags.PRIVATE + | Flags.STATIC + | Flags.SYNCHRONIZED + | Flags.NATIVE); // set the AccSuper flag (has to be done after clearing AccSynchronized - since same value) if (!aType.isInterface()) { // class or enum - accessFlags |= ClassFileConstants.AccSuper; + accessFlags |= Flags.ACC_SUPER; } if (aType.isAnonymousType()) { ReferenceBinding superClass = aType.superclass; if (superClass == null || !(superClass.isEnum() && superClass.isSealed())) - accessFlags &= ~ClassFileConstants.AccFinal; + accessFlags &= ~Flags.FINAL; } - int finalAbstract = ClassFileConstants.AccFinal | ClassFileConstants.AccAbstract; + int finalAbstract = Flags.FINAL | Flags.ABSTRACT; if ((accessFlags & finalAbstract) == finalAbstract) { accessFlags &= ~finalAbstract; } @@ -5991,7 +5992,7 @@ public void initialize(SourceTypeBinding aType, ClassFile parentClassFile, boole } public void initializeForModule(ModuleBinding module) { - initializeHeader(null, ClassFileConstants.AccModule); + initializeHeader(null, Flags.ACC_MODULE); int classNameIndex = this.constantPool.literalIndexForType(TypeConstants.MODULE_INFO_NAME); this.contents[this.contentsOffset++] = (byte) (classNameIndex >> 8); this.contents[this.contentsOffset++] = (byte) classNameIndex; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java index 8d777ba4486..a5cb43e9b27 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/Compiler.java @@ -16,18 +16,40 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler; -import org.eclipse.jdt.core.compiler.*; -import org.eclipse.jdt.internal.compiler.env.*; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.ast.*; +import java.io.PrintWriter; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.compiler.CompilationProgress; +import org.eclipse.jdt.core.compiler.IProblem; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ImportReference; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.parser.*; -import org.eclipse.jdt.internal.compiler.problem.*; -import org.eclipse.jdt.internal.compiler.util.*; - -import java.io.*; -import java.util.*; +import org.eclipse.jdt.internal.compiler.env.AccessRestriction; +import org.eclipse.jdt.internal.compiler.env.IBinaryType; +import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; +import org.eclipse.jdt.internal.compiler.env.INameEnvironment; +import org.eclipse.jdt.internal.compiler.env.ISourceType; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.impl.CompilerStats; +import org.eclipse.jdt.internal.compiler.impl.ITypeRequestor; +import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeCollisionException; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; +import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit; +import org.eclipse.jdt.internal.compiler.problem.DefaultProblem; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; +import org.eclipse.jdt.internal.compiler.util.Messages; +import org.eclipse.jdt.internal.compiler.util.Util; @SuppressWarnings("rawtypes") public class Compiler implements ITypeRequestor, ProblemSeverities { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchFilerImpl.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchFilerImpl.java index 66c9a55ca86..6accd7373d0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchFilerImpl.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/dispatch/BatchFilerImpl.java @@ -27,9 +27,9 @@ import javax.lang.model.element.TypeElement; import javax.tools.FileObject; import javax.tools.JavaFileManager; +import javax.tools.JavaFileManager.Location; import javax.tools.JavaFileObject; import javax.tools.StandardLocation; -import javax.tools.JavaFileManager.Location; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java index f8503e1b67b..7003544cad5 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java @@ -60,6 +60,8 @@ import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; +import com.sun.tools.javac.code.Flags; + /** * Creates javax.lang.model wrappers around JDT internal compiler bindings. */ @@ -164,16 +166,16 @@ private static void decodeModifiers(Set result, int modifiers, int[] c if (checkBits == null) return; for (int i = 0, max = checkBits.length; i < max; i++) { switch(checkBits[i]) { - case ClassFileConstants.AccPublic : + case Flags.PUBLIC : appendModifier(result, modifiers, checkBits[i], Modifier.PUBLIC); break; - case ClassFileConstants.AccProtected: + case Flags.PROTECTED: appendModifier(result, modifiers, checkBits[i], Modifier.PROTECTED); break; - case ClassFileConstants.AccPrivate : + case Flags.PRIVATE : appendModifier(result, modifiers, checkBits[i], Modifier.PRIVATE); break; - case ClassFileConstants.AccAbstract : + case Flags.ABSTRACT : appendModifier(result, modifiers, checkBits[i], Modifier.ABSTRACT); break; case ExtraCompilerModifiers.AccDefaultMethod : @@ -183,25 +185,25 @@ private static void decodeModifiers(Set result, int modifiers, int[] c // Don't have JDK 1.8, just ignore and proceed. } break; - case ClassFileConstants.AccStatic : + case Flags.STATIC : appendModifier(result, modifiers, checkBits[i], Modifier.STATIC); break; - case ClassFileConstants.AccFinal : + case Flags.FINAL : appendModifier(result, modifiers, checkBits[i], Modifier.FINAL); break; - case ClassFileConstants.AccSynchronized : + case Flags.SYNCHRONIZED : appendModifier(result, modifiers, checkBits[i], Modifier.SYNCHRONIZED); break; - case ClassFileConstants.AccNative : + case Flags.NATIVE : appendModifier(result, modifiers, checkBits[i], Modifier.NATIVE); break; - case ClassFileConstants.AccStrictfp : + case Flags.STRICTFP : appendModifier(result, modifiers, checkBits[i], Modifier.STRICTFP); break; - case ClassFileConstants.AccTransient : + case Flags.TRANSIENT : appendModifier(result, modifiers, checkBits[i], Modifier.TRANSIENT); break; - case ClassFileConstants.AccVolatile : + case Flags.VOLATILE : appendModifier(result, modifiers, checkBits[i], Modifier.VOLATILE); break; case ExtraCompilerModifiers.AccNonSealed : @@ -275,15 +277,15 @@ public static Set getModifiers(int modifiers, ElementKind kind, boolea case METHOD : // modifiers for methods decodeModifiers(result, modifiers, new int[] { - ClassFileConstants.AccPublic, - ClassFileConstants.AccProtected, - ClassFileConstants.AccPrivate, - ClassFileConstants.AccAbstract, - ClassFileConstants.AccStatic, - ClassFileConstants.AccFinal, - ClassFileConstants.AccSynchronized, - ClassFileConstants.AccNative, - ClassFileConstants.AccStrictfp, + Flags.PUBLIC, + Flags.PROTECTED, + Flags.PRIVATE, + Flags.ABSTRACT, + Flags.STATIC, + Flags.FINAL, + Flags.SYNCHRONIZED, + Flags.NATIVE, + Flags.STRICTFP, ExtraCompilerModifiers.AccDefaultMethod }); break; @@ -291,36 +293,36 @@ public static Set getModifiers(int modifiers, ElementKind kind, boolea case ENUM_CONSTANT : // for fields decodeModifiers(result, modifiers, new int[] { - ClassFileConstants.AccPublic, - ClassFileConstants.AccProtected, - ClassFileConstants.AccPrivate, - ClassFileConstants.AccStatic, - ClassFileConstants.AccFinal, - ClassFileConstants.AccTransient, - ClassFileConstants.AccVolatile + Flags.PUBLIC, + Flags.PROTECTED, + Flags.PRIVATE, + Flags.STATIC, + Flags.FINAL, + Flags.TRANSIENT, + Flags.VOLATILE }); break; case ENUM : if (isFromBinary) { decodeModifiers(result, modifiers, new int[] { - ClassFileConstants.AccPublic, - ClassFileConstants.AccProtected, - ClassFileConstants.AccFinal, - ClassFileConstants.AccPrivate, - ClassFileConstants.AccAbstract, - ClassFileConstants.AccStatic, - ClassFileConstants.AccStrictfp, + Flags.PUBLIC, + Flags.PROTECTED, + Flags.FINAL, + Flags.PRIVATE, + Flags.ABSTRACT, + Flags.STATIC, + Flags.STRICTFP, ExtraCompilerModifiers.AccSealed, }); } else { // enum from source cannot be explicitly abstract decodeModifiers(result, modifiers, new int[] { - ClassFileConstants.AccPublic, - ClassFileConstants.AccProtected, - ClassFileConstants.AccFinal, - ClassFileConstants.AccPrivate, - ClassFileConstants.AccStatic, - ClassFileConstants.AccStrictfp, + Flags.PUBLIC, + Flags.PROTECTED, + Flags.FINAL, + Flags.PRIVATE, + Flags.STATIC, + Flags.STRICTFP, ExtraCompilerModifiers.AccSealed, }); } @@ -331,13 +333,13 @@ public static Set getModifiers(int modifiers, ElementKind kind, boolea case RECORD : // for type decodeModifiers(result, modifiers, new int[] { - ClassFileConstants.AccPublic, - ClassFileConstants.AccProtected, - ClassFileConstants.AccAbstract, - ClassFileConstants.AccFinal, - ClassFileConstants.AccPrivate, - ClassFileConstants.AccStatic, - ClassFileConstants.AccStrictfp, + Flags.PUBLIC, + Flags.PROTECTED, + Flags.ABSTRACT, + Flags.FINAL, + Flags.PRIVATE, + Flags.STATIC, + Flags.STRICTFP, ExtraCompilerModifiers.AccSealed, ExtraCompilerModifiers.AccNonSealed }); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java index da73d9101b8..7f4a52c2cf0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/ModuleElementImpl.java @@ -14,8 +14,8 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.apt.model; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java index 25efe4152f0..8b4c14a3c67 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java @@ -40,7 +40,6 @@ import org.eclipse.jdt.internal.compiler.apt.dispatch.BaseProcessingEnvImpl; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; @@ -51,6 +50,8 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; +import com.sun.tools.javac.code.Flags; + public class TypeElementImpl extends ElementImpl implements TypeElement { /** @@ -283,7 +284,7 @@ public Set getModifiers() ReferenceBinding refBinding = (ReferenceBinding)this._binding; int modifiers = refBinding.modifiers; if (refBinding.isInterface() && refBinding.isNestedType()) { - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } return Factory.getModifiers(modifiers, getKind(), refBinding.isBinaryBinding()); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java index 826b204a060..11d5d4d9995 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java @@ -30,7 +30,6 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.apt.dispatch.BaseProcessingEnvImpl; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; import org.eclipse.jdt.internal.compiler.lookup.AptBinaryLocalVariableBinding; @@ -42,6 +41,8 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; +import com.sun.tools.javac.code.Flags; + /** * Implementation of VariableElement, which represents a a field, enum constant, * method or constructor parameter, local variable, or exception parameter. @@ -119,7 +120,7 @@ else if (this._binding instanceof AptSourceLocalVariableBinding){ @Override public ElementKind getKind() { if (this._binding instanceof FieldBinding) { - if ((((FieldBinding) this._binding).modifiers & ClassFileConstants.AccEnum) != 0) { + if ((((FieldBinding) this._binding).modifiers & Flags.ENUM) != 0) { return ElementKind.ENUM_CONSTANT; } else { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java index 9acba9562ac..dead9ed688e 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AND_AND_Expression.java @@ -19,10 +19,15 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //dedicated treatment for the && public class AND_AND_Expression extends BinaryExpression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java index e85aa8503d5..d307996a90c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ASTNode.java @@ -89,6 +89,8 @@ import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({"rawtypes", "unchecked"}) public abstract class ASTNode implements TypeConstants, TypeIds { @@ -689,25 +691,25 @@ public static StringBuffer printIndent(int indent, StringBuffer output) { public static StringBuffer printModifiers(int modifiers, StringBuffer output) { - if ((modifiers & ClassFileConstants.AccPublic) != 0) + if ((modifiers & Flags.PUBLIC) != 0) output.append("public "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccPrivate) != 0) + if ((modifiers & Flags.PRIVATE) != 0) output.append("private "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccProtected) != 0) + if ((modifiers & Flags.PROTECTED) != 0) output.append("protected "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccStatic) != 0) + if ((modifiers & Flags.STATIC) != 0) output.append("static "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccFinal) != 0) + if ((modifiers & Flags.FINAL) != 0) output.append("final "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccSynchronized) != 0) + if ((modifiers & Flags.SYNCHRONIZED) != 0) output.append("synchronized "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccVolatile) != 0) + if ((modifiers & Flags.VOLATILE) != 0) output.append("volatile "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccTransient) != 0) + if ((modifiers & Flags.TRANSIENT) != 0) output.append("transient "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccNative) != 0) + if ((modifiers & Flags.NATIVE) != 0) output.append("native "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccAbstract) != 0) + if ((modifiers & Flags.ABSTRACT) != 0) output.append("abstract "); //$NON-NLS-1$ if ((modifiers & ExtraCompilerModifiers.AccDefaultMethod) != 0) output.append("default "); //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java index 5d1566780d9..871ac448534 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java @@ -32,18 +32,40 @@ import java.util.List; -import org.eclipse.jdt.core.compiler.*; -import org.eclipse.jdt.internal.compiler.*; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.compiler.IProblem; +import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.ClassFile; +import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationPosition; -import org.eclipse.jdt.internal.compiler.flow.FlowInfo; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.problem.*; -import org.eclipse.jdt.internal.compiler.parser.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; +import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit; +import org.eclipse.jdt.internal.compiler.problem.AbortMethod; +import org.eclipse.jdt.internal.compiler.problem.AbortType; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({"rawtypes"}) public abstract class AbstractMethodDeclaration extends ASTNode @@ -417,7 +439,7 @@ public boolean isAbstract() { if (this.binding != null) return this.binding.isAbstract(); - return (this.modifiers & ClassFileConstants.AccAbstract) != 0; + return (this.modifiers & Flags.ABSTRACT) != 0; } public boolean isAnnotationMethod() { @@ -462,7 +484,7 @@ public boolean isNative() { if (this.binding != null) return this.binding.isNative(); - return (this.modifiers & ClassFileConstants.AccNative) != 0; + return (this.modifiers & Flags.NATIVE) != 0; } public RecordComponent getRecordComponent() { @@ -473,7 +495,7 @@ public boolean isStatic() { if (this.binding != null) return this.binding.isStatic(); - return (this.modifiers & ClassFileConstants.AccStatic) != 0; + return (this.modifiers & Flags.STATIC) != 0; } /** diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java index 53e62de4374..e100ac38f61 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AllocationExpression.java @@ -54,21 +54,54 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.*; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.ASSIGNMENT_CONTEXT; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.INVOCATION_CONTEXT; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.VANILLA_CONTEXT; import java.util.HashMap; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.ImplicitNullAnnotationVerifier; +import org.eclipse.jdt.internal.compiler.lookup.InferenceContext18; +import org.eclipse.jdt.internal.compiler.lookup.InvocationSite; +import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.RawTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticFactoryMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; public class AllocationExpression extends Expression implements IPolyExpression, Invocation { @@ -364,7 +397,7 @@ public TypeBinding resolveType(BlockScope scope) { if (currentType == null) return currentType; do { // isStatic() is answering true for toplevel types - if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation; + if ((currentType.modifiers & Flags.STATIC) != 0) break checkParameterizedAllocation; if (currentType.isRawType()) break checkParameterizedAllocation; } while ((currentType = currentType.enclosingType())!= null); ParameterizedQualifiedTypeReference qRef = (ParameterizedQualifiedTypeReference) this.type; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java index d7e186c0598..b1ad53a1b3f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Annotation.java @@ -48,7 +48,28 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.impl.IrritantSet; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceModuleBinding; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; /** * Annotation diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Argument.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Argument.java index 2d19f0957a9..0a61fb80e2c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Argument.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Argument.java @@ -28,7 +28,22 @@ import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationPosition; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.CatchParameterBinding; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; + +import com.sun.tools.javac.code.Flags; public class Argument extends LocalDeclaration { @@ -243,7 +258,7 @@ public TypeBinding resolveForCatch(BlockScope scope) { } if ((this.type.bits & ASTNode.IsUnionType) != 0) { - this.binding = new CatchParameterBinding(this, exceptionType, this.modifiers | ClassFileConstants.AccFinal, false); // argument decl, but local var (where isArgument = false) + this.binding = new CatchParameterBinding(this, exceptionType, this.modifiers | Flags.FINAL, false); // argument decl, but local var (where isArgument = false) this.binding.tagBits |= TagBits.MultiCatchParameter; } else { this.binding = new CatchParameterBinding(this, exceptionType, this.modifiers, false); // argument decl, but local var (where isArgument = false) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java index 2a298198f19..eb431542769 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayAllocationExpression.java @@ -25,11 +25,16 @@ import java.util.List; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class ArrayAllocationExpression extends Expression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java index dd48533ef69..412f4c9bb9c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayInitializer.java @@ -25,11 +25,14 @@ import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.ASSIGNMENT_CONTEXT; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class ArrayInitializer extends Expression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java index 1fbbae8fdc7..5f6c74cf9af 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ArrayQualifiedTypeReference.java @@ -17,7 +17,11 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; public class ArrayQualifiedTypeReference extends QualifiedTypeReference { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java index 80c92463dab..d4d17263e9d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/AssertStatement.java @@ -18,17 +18,23 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; +import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import com.sun.tools.javac.jvm.ByteCodes; -import org.eclipse.jdt.internal.compiler.ASTVisitor; - public class AssertStatement extends Statement { public Expression assertExpression, exceptionArgument; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Assignment.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Assignment.java index 4dfb485b6cc..9bd8bbd9851 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Assignment.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Assignment.java @@ -39,11 +39,20 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; public class Assignment extends Expression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java index f542b5601d1..edd9e6b4c25 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BinaryExpression.java @@ -19,11 +19,17 @@ import java.util.List; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public class BinaryExpression extends OperatorExpression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Block.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Block.java index fc8e826f852..9d3552775af 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Block.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Block.java @@ -21,10 +21,13 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; public class Block extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BranchStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BranchStatement.java index 59522dfa930..ad3ab849b42 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BranchStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BranchStatement.java @@ -13,8 +13,9 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; public abstract class BranchStatement extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java index 73f0914e174..319bcd2ffce 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/BreakStatement.java @@ -16,8 +16,10 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.InsideSubRoutineFlowContext; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; public class BreakStatement extends BranchStatement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java index d417380ea92..d45f7ac10a1 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CaseStatement.java @@ -17,7 +17,6 @@ import java.util.List; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.flow.FlowContext; @@ -34,6 +33,8 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import com.sun.tools.javac.code.Flags; + public class CaseStatement extends Statement { static final int CASE_CONSTANT = 1; @@ -447,7 +448,7 @@ public Constant resolveConstantExpression(BlockScope scope, && (expression.bits & ASTNode.RestrictiveFlagMASK) == Binding.FIELD) { NameReference reference = (NameReference) expression; FieldBinding field = reference.fieldBinding(); - if ((field.modifiers & ClassFileConstants.AccEnum) == 0) { + if ((field.modifiers & Flags.ENUM) == 0) { scope.problemReporter().enumSwitchCannotTargetField(reference, field); } else if (reference instanceof QualifiedNameReference) { scope.problemReporter().cannotUseQualifiedEnumConstantInCaseLabel(reference, field); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java index 6d1846b63e0..a28256ece8b 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CharLiteral.java @@ -14,9 +14,10 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.impl.CharConstant; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.parser.ScannerHelper; public class CharLiteral extends NumberLiteral { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java index 04d8f6e547e..9aa7b1389e2 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ClassLiteralAccess.java @@ -15,10 +15,19 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; public class ClassLiteralAccess extends Expression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java index 7a3a98b6804..6b79d666e8d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java @@ -32,7 +32,6 @@ import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.ast.LambdaExpression.LocalTypeSubstitutor; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; @@ -46,9 +45,9 @@ import org.eclipse.jdt.internal.compiler.lookup.MethodScope; import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding; import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.Substitution.NullSubstitution; import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; -import org.eclipse.jdt.internal.compiler.lookup.Substitution.NullSubstitution; import org.eclipse.jdt.internal.compiler.parser.NLSTag; import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit; import org.eclipse.jdt.internal.compiler.problem.AbortMethod; @@ -57,6 +56,8 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; import org.eclipse.jdt.internal.compiler.util.HashSetOfInt; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({ "rawtypes", "unchecked" }) public class CompilationUnitDeclaration extends ASTNode implements ProblemSeverities, ReferenceContext { @@ -223,7 +224,7 @@ public CompilationResult compilationResult() { public void createPackageInfoType() { TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); declaration.name = TypeConstants.PACKAGE_INFO_NAME; - declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; + declaration.modifiers = 0 | Flags.INTERFACE; declaration.javadoc = this.javadoc; this.types[0] = declaration; // Assumes the first slot is meant for this type } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java index e98fa2fbcf0..69db408dbeb 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/CompoundAssignment.java @@ -21,10 +21,14 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class CompoundAssignment extends Assignment implements OperatorIds { public int operator; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java index 0811776e124..dc1f4fe3488 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ConditionalExpression.java @@ -31,15 +31,30 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.*; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.ASSIGNMENT_CONTEXT; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.INVOCATION_CONTEXT; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.VANILLA_CONTEXT; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.PolyTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public class ConditionalExpression extends OperatorExpression implements IPolyExpression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ContinueStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ContinueStatement.java index ff8d8956c09..914417526ea 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ContinueStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ContinueStatement.java @@ -16,8 +16,10 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.InsideSubRoutineFlowContext; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; public class ContinueStatement extends BranchStatement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java index 8bd10b46134..9ba474b2c77 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoStatement.java @@ -19,10 +19,17 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext; +import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public class DoStatement extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java index 87c58ad5192..d493a3852f9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/DoubleLiteral.java @@ -15,9 +15,10 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.impl.DoubleConstant; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.util.FloatUtil; public class DoubleLiteral extends NumberLiteral { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EmptyStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EmptyStatement.java index 6a67a4eb3d5..a60d26cc774 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EmptyStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EmptyStatement.java @@ -14,12 +14,12 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.flow.FlowContext; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; -import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; public class EmptyStatement extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java index 466f04e0467..3d010c9a70a 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java @@ -20,11 +20,22 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; +import org.eclipse.jdt.internal.compiler.impl.BooleanConstant; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public class EqualExpression extends BinaryExpression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java index 9ea39f5656a..bacef476e0c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FakeDefaultLiteral.java @@ -14,7 +14,8 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; /** * Sole purpose of {@link FakeDefaultLiteral} is to appear diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java index 7da61f5ee75..f05fd0d02c4 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/FieldDeclaration.java @@ -23,22 +23,36 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import java.util.List; - import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.ASSIGNMENT_CONTEXT; +import java.util.List; + import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; public class FieldDeclaration extends AbstractVariableDeclaration { @@ -175,13 +189,13 @@ public int getKind() { public boolean isStatic() { if (this.binding != null) return this.binding.isStatic(); - return (this.modifiers & ClassFileConstants.AccStatic) != 0; + return (this.modifiers & Flags.STATIC) != 0; } public boolean isFinal() { if (this.binding != null) return this.binding.isFinal(); - return (this.modifiers & ClassFileConstants.AccFinal) != 0; + return (this.modifiers & Flags.FINAL) != 0; } @Override public StringBuffer print(int indent, StringBuffer output) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java index 8926fd82ee6..bca5ee69954 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ForeachStatement.java @@ -700,18 +700,18 @@ public void resolve(BlockScope upperScope) { switch(this.kind) { case ARRAY : // allocate #index secret variable (of type int) - this.indexVariable = new LocalVariableBinding(SecretIndexVariableName, TypeBinding.INT, ClassFileConstants.AccDefault, false); + this.indexVariable = new LocalVariableBinding(SecretIndexVariableName, TypeBinding.INT, 0, false); this.scope.addLocalVariable(this.indexVariable); this.indexVariable.setConstant(Constant.NotAConstant); // not inlinable // allocate #max secret variable - this.maxVariable = new LocalVariableBinding(SecretMaxVariableName, TypeBinding.INT, ClassFileConstants.AccDefault, false); + this.maxVariable = new LocalVariableBinding(SecretMaxVariableName, TypeBinding.INT, 0, false); this.scope.addLocalVariable(this.maxVariable); this.maxVariable.setConstant(Constant.NotAConstant); // not inlinable // add #array secret variable (of collection type) if (expectedCollectionType == null) { - this.collectionVariable = new LocalVariableBinding(SecretCollectionVariableName, collectionType, ClassFileConstants.AccDefault, false); + this.collectionVariable = new LocalVariableBinding(SecretCollectionVariableName, collectionType, 0, false); } else { - this.collectionVariable = new LocalVariableBinding(SecretCollectionVariableName, expectedCollectionType, ClassFileConstants.AccDefault, false); + this.collectionVariable = new LocalVariableBinding(SecretCollectionVariableName, expectedCollectionType, 0, false); } this.scope.addLocalVariable(this.collectionVariable); this.collectionVariable.setConstant(Constant.NotAConstant); // not inlinable @@ -719,7 +719,7 @@ public void resolve(BlockScope upperScope) { case RAW_ITERABLE : case GENERIC_ITERABLE : // allocate #index secret variable (of type Iterator) - this.indexVariable = new LocalVariableBinding(SecretIteratorVariableName, this.scope.getJavaUtilIterator(), ClassFileConstants.AccDefault, false); + this.indexVariable = new LocalVariableBinding(SecretIteratorVariableName, this.scope.getJavaUtilIterator(), 0, false); this.scope.addLocalVariable(this.indexVariable); this.indexVariable.setConstant(Constant.NotAConstant); // not inlinable break; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IfStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IfStatement.java index d5af0e01b0e..8e06077ce67 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IfStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IfStatement.java @@ -20,10 +20,14 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class IfStatement extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ImportReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ImportReference.java index 07462bdad5f..1356e607ca5 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ImportReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ImportReference.java @@ -17,9 +17,13 @@ import java.util.Set; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; +import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding; +import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; +import org.eclipse.jdt.internal.compiler.lookup.SplitPackageBinding; + +import com.sun.tools.javac.code.Flags; public class ImportReference extends ASTNode { @@ -50,7 +54,7 @@ public ImportReference( } public boolean isStatic() { - return (this.modifiers & ClassFileConstants.AccStatic) != 0; + return (this.modifiers & Flags.STATIC) != 0; } public char[][] getImportName() { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Initializer.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Initializer.java index 90cd2996e06..719dab8a459 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Initializer.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Initializer.java @@ -18,10 +18,20 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.parser.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.parser.Parser; + +import com.sun.tools.javac.code.Flags; public class Initializer extends FieldDeclaration { @@ -82,7 +92,7 @@ public int getKind() { @Override public boolean isStatic() { - return (this.modifiers & ClassFileConstants.AccStatic) != 0; + return (this.modifiers & Flags.STATIC) != 0; } public void parseStatements( @@ -147,7 +157,7 @@ public MethodBinding getMethodBinding() { if (this.methodBinding == null) { Scope scope = this.block.scope; this.methodBinding = isStatic() - ? new MethodBinding(ClassFileConstants.AccStatic, CharOperation.NO_CHAR, TypeBinding.VOID, Binding.NO_PARAMETERS, Binding.NO_EXCEPTIONS, scope.enclosingSourceType()) + ? new MethodBinding(Flags.STATIC, CharOperation.NO_CHAR, TypeBinding.VOID, Binding.NO_PARAMETERS, Binding.NO_EXCEPTIONS, scope.enclosingSourceType()) : new MethodBinding(0, CharOperation.NO_CHAR, TypeBinding.VOID, Binding.NO_PARAMETERS, Binding.NO_EXCEPTIONS, scope.enclosingSourceType()); } return this.methodBinding; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java index db8e16d08f6..5a6cdc21009 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/InstanceOfExpression.java @@ -27,11 +27,21 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationPosition; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public class InstanceOfExpression extends OperatorExpression { @@ -300,7 +310,7 @@ private void addSecretInstanceOfPatternExpressionValue(BlockScope scope1) { new LocalVariableBinding( InstanceOfExpression.SECRET_INSTANCEOF_PATTERN_EXPRESSION_VALUE, TypeBinding.wellKnownType(scope1, T_JavaLangObject), - ClassFileConstants.AccDefault, + 0, false); local.setConstant(Constant.NotAConstant); local.useFlag = LocalVariableBinding.USED; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java index 5dfed33eeec..c70d81428cc 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/IntLiteralMinValue.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import org.eclipse.jdt.internal.compiler.impl.*; +import org.eclipse.jdt.internal.compiler.impl.IntConstant; public class IntLiteralMinValue extends IntLiteral { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java index f52a9b7a2bf..0dc9be25a79 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Javadoc.java @@ -20,9 +20,26 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.ImportBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding; +import org.eclipse.jdt.internal.compiler.lookup.ModuleScope; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.parser.JavadocTagConstants; +import com.sun.tools.javac.code.Flags; + /** * Node representing a structured Javadoc comment */ @@ -58,14 +75,14 @@ public Javadoc(int sourceStart, int sourceEnd) { boolean canBeSeen(int visibility, int modifiers) { if (modifiers < 0) return true; switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) { - case ClassFileConstants.AccPublic : + case Flags.PUBLIC : return true; - case ClassFileConstants.AccProtected: - return (visibility != ClassFileConstants.AccPublic); - case ClassFileConstants.AccDefault: - return (visibility == ClassFileConstants.AccDefault || visibility == ClassFileConstants.AccPrivate); - case ClassFileConstants.AccPrivate: - return (visibility == ClassFileConstants.AccPrivate); + case Flags.PROTECTED: + return (visibility != Flags.PUBLIC); + case 0: + return (visibility == 0 || visibility == Flags.PRIVATE); + case Flags.PRIVATE: + return (visibility == Flags.PRIVATE); } return true; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java index d0c1c6d56a3..e1296ccb8db 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocAllocationExpression.java @@ -16,7 +16,17 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class JavadocAllocationExpression extends AllocationExpression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java index 87614976fa3..c800d4868f2 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocArgumentExpression.java @@ -16,7 +16,10 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class JavadocArgumentExpression extends Expression { public char[] token; @@ -27,7 +30,7 @@ public JavadocArgumentExpression(char[] name, int startPos, int endPos, TypeRefe this.sourceStart = startPos; this.sourceEnd = endPos; long pos = (((long) startPos) << 32) + endPos; - this.argument = new Argument(name, pos, typeRef, ClassFileConstants.AccDefault); + this.argument = new Argument(name, pos, typeRef, 0); this.bits |= InsideJavadoc; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java index d8e29ee3cf8..cd5e3da2af2 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocFieldReference.java @@ -17,7 +17,18 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemFieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class JavadocFieldReference extends FieldReference { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java index 093658e0fd3..7b904786011 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocImplicitTypeReference.java @@ -17,7 +17,12 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class JavadocImplicitTypeReference extends TypeReference { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java index 4fdc64dc718..53ce05302b9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocMessageSend.java @@ -16,7 +16,15 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class JavadocMessageSend extends MessageSend { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java index 9e3b0828ab1..1590e4dda0e 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocReturnStatement.java @@ -14,7 +14,11 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class JavadocReturnStatement extends ReturnStatement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java index a59e0a28e97..77b514ffa1a 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java @@ -14,7 +14,11 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; public class JavadocSingleNameReference extends SingleNameReference { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java index fa0b95186db..511354913c0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LabeledStatement.java @@ -14,9 +14,13 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.LabelFlowContext; +import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; public class LabeledStatement extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java index fcc1528fb01..95d780a5e31 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LambdaExpression.java @@ -61,7 +61,6 @@ import org.eclipse.jdt.internal.compiler.ClassFile; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.flow.ExceptionHandlingFlowContext; import org.eclipse.jdt.internal.compiler.flow.ExceptionInferenceFlowContext; @@ -90,6 +89,7 @@ import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.Scope.Substitutor; import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.Substitution; import org.eclipse.jdt.internal.compiler.lookup.Substitution.NullSubstitution; @@ -100,7 +100,6 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; -import org.eclipse.jdt.internal.compiler.lookup.Scope.Substitutor; import org.eclipse.jdt.internal.compiler.parser.Parser; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit; @@ -108,6 +107,8 @@ import org.eclipse.jdt.internal.compiler.problem.AbortType; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({"rawtypes", "unchecked"}) public class LambdaExpression extends FunctionalExpression implements IPolyExpression, ReferenceContext, ProblemSeverities { public Argument [] arguments; @@ -193,9 +194,9 @@ protected FunctionalExpression original() { @Override public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) { if (this.shouldCaptureInstance) { - this.binding.modifiers &= ~ClassFileConstants.AccStatic; + this.binding.modifiers &= ~Flags.STATIC; } else { - this.binding.modifiers |= ClassFileConstants.AccStatic; + this.binding.modifiers |= Flags.STATIC; } SourceTypeBinding sourceType = currentScope.enclosingSourceType(); boolean firstSpill = !(this.binding instanceof SyntheticMethodBinding); @@ -290,7 +291,7 @@ public TypeBinding resolveType(BlockScope blockScope, boolean skipKosherCheck) { if (!skipKosherCheck && (!haveDescriptor || this.descriptor.typeVariables != Binding.NO_TYPE_VARIABLES)) // already complained in kosher* return this.resolvedType = null; - this.binding = new MethodBinding(ClassFileConstants.AccPrivate | ClassFileConstants.AccSynthetic | ExtraCompilerModifiers.AccUnresolved, + this.binding = new MethodBinding(Flags.PRIVATE | Flags.SYNTHETIC | ExtraCompilerModifiers.AccUnresolved, CharOperation.concat(TypeConstants.ANONYMOUS_METHOD, Integer.toString(this.ordinal).toCharArray()), // will be fixed up later. haveDescriptor ? this.descriptor.returnType : TypeBinding.VOID, Binding.NO_PARAMETERS, // for now. @@ -319,7 +320,7 @@ public TypeBinding resolveType(BlockScope blockScope, boolean skipKosherCheck) { Argument argument = this.arguments[i]; if (argument.isVarArgs()) { if (i == argumentsLength - 1) { - this.binding.modifiers |= ClassFileConstants.AccVarargs; + this.binding.modifiers |= Flags.ACC_VARARGS; } else { this.scope.problemReporter().illegalVarargInLambda(argument); argumentsHaveErrors = true; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Literal.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Literal.java index 0b07e127cde..0cceb2b7170 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Literal.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Literal.java @@ -15,8 +15,9 @@ import org.eclipse.jdt.internal.compiler.flow.FlowContext; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public abstract class Literal extends Expression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java index 5f6f34fe969..2bcd0e852d4 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LocalDeclaration.java @@ -47,14 +47,26 @@ import java.util.Set; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBindingVisitor; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.parser.RecoveryScanner; +import com.sun.tools.javac.code.Flags; + public class LocalDeclaration extends AbstractVariableDeclaration { public LocalVariableBinding binding; @@ -123,7 +135,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl public void checkModifiers() { //only potential valid modifier is <> - if (((this.modifiers & ExtraCompilerModifiers.AccJustFlag) & ~ClassFileConstants.AccFinal) != 0) + if (((this.modifiers & ExtraCompilerModifiers.AccJustFlag) & ~Flags.FINAL) != 0) //AccModifierProblem -> other (non-visibility problem) //AccAlternateModifierProblem -> duplicate modifier //AccModifierProblem | AccAlternateModifierProblem -> visibility problem" @@ -310,7 +322,7 @@ public void resolve(BlockScope scope, boolean isPatternVariable) { } } - if ((this.modifiers & ClassFileConstants.AccFinal)!= 0 && this.initialization == null) { + if ((this.modifiers & Flags.FINAL)!= 0 && this.initialization == null) { this.modifiers |= ExtraCompilerModifiers.AccBlankFinal; } if (isTypeNameVar) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java index 183ca98d2b5..c687a35ffa3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/LongLiteralMinValue.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import org.eclipse.jdt.internal.compiler.impl.*; +import org.eclipse.jdt.internal.compiler.impl.LongConstant; public class LongLiteralMinValue extends LongLiteral { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java index a86cd21b949..ed0e138be59 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MarkerAnnotation.java @@ -20,7 +20,8 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; public class MarkerAnnotation extends Annotation { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MessageSend.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MessageSend.java index 15c81cafd73..d46e9f972e8 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MessageSend.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MessageSend.java @@ -65,7 +65,9 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.*; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.ASSIGNMENT_CONTEXT; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.INVOCATION_CONTEXT; +import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.VANILLA_CONTEXT; import java.util.HashMap; import java.util.function.BiConsumer; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java index 49ef2ab2c58..b52b426eb17 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/MethodDeclaration.java @@ -56,6 +56,8 @@ import org.eclipse.jdt.internal.compiler.problem.AbortMethod; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; +import com.sun.tools.javac.code.Flags; + public class MethodDeclaration extends AbstractMethodDeclaration { public TypeReference returnType; @@ -274,9 +276,9 @@ public void resolveStatements() { if (this.typeParameters != null) this.scope.problemReporter().recordAccessorMethodShouldNotBeGeneric(this); if (this.binding != null) { - if ((this.binding.modifiers & ClassFileConstants.AccPublic) == 0) + if ((this.binding.modifiers & Flags.PUBLIC) == 0) this.scope.problemReporter().recordAccessorMethodShouldBePublic(this); - if ((this.binding.modifiers & ClassFileConstants.AccStatic) != 0) + if ((this.binding.modifiers & Flags.STATIC) != 0) this.scope.problemReporter().recordAccessorMethodShouldNotBeStatic(this); } if (this.thrownExceptions != null) @@ -314,12 +316,12 @@ public void resolveStatements() { boolean hasUnresolvedArguments = (this.binding.tagBits & TagBits.HasUnresolvedArguments) != 0; if (hasOverrideAnnotation && !hasUnresolvedArguments) { // no static method is considered overriding - if ((bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) + if ((bindingModifiers & (Flags.STATIC|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) break checkOverride; // in 1.5, strictly for overriding superclass method // in 1.6 and above, also tolerate implementing interface method if (complianceLevel >= ClassFileConstants.JDK1_6 - && ((bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccImplementing)) == ExtraCompilerModifiers.AccImplementing)) + && ((bindingModifiers & (Flags.STATIC|ExtraCompilerModifiers.AccImplementing)) == ExtraCompilerModifiers.AccImplementing)) break checkOverride; // claims to override, and doesn't actually do so this.scope.problemReporter().methodMustOverride(this, complianceLevel); @@ -327,7 +329,7 @@ public void resolveStatements() { //In case of a concrete class method, we have to check if it overrides(in 1.5 and above) OR implements a method(1.6 and above). //Also check if the method has a signature that is override-equivalent to that of any public method declared in Object. if (!this.binding.declaringClass.isInterface()){ - if((bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) { + if((bindingModifiers & (Flags.STATIC|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) { this.scope.problemReporter().missingOverrideAnnotation(this); } else { if(complianceLevel >= ClassFileConstants.JDK1_6 @@ -344,7 +346,7 @@ public void resolveStatements() { //Also check if the method has a signature that is override-equivalent to that of any public method declared in Object. if(complianceLevel >= ClassFileConstants.JDK1_6 && compilerOptions.reportMissingOverrideAnnotationForInterfaceMethodImplementation - && (((bindingModifiers & (ClassFileConstants.AccStatic|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) || this.binding.isImplementing())){ + && (((bindingModifiers & (Flags.STATIC|ExtraCompilerModifiers.AccOverriding)) == ExtraCompilerModifiers.AccOverriding) || this.binding.isImplementing())){ // actually overrides, but did not claim to do so this.scope.problemReporter().missingOverrideAnnotationForInterfaceMethodImplementation(this); } @@ -362,12 +364,12 @@ public void resolveStatements() { // if a method has an semicolon body and is not declared as abstract==>error // native methods may have a semicolon body if ((this.modifiers & ExtraCompilerModifiers.AccSemicolonBody) != 0) { - if ((this.modifiers & ClassFileConstants.AccNative) == 0) - if ((this.modifiers & ClassFileConstants.AccAbstract) == 0) + if ((this.modifiers & Flags.NATIVE) == 0) + if ((this.modifiers & Flags.ABSTRACT) == 0) this.scope.problemReporter().methodNeedBody(this); } else { // the method HAS a body --> abstract native modifiers are forbidden - if (((this.modifiers & ClassFileConstants.AccNative) != 0) || ((this.modifiers & ClassFileConstants.AccAbstract) != 0)) + if (((this.modifiers & Flags.NATIVE) != 0) || ((this.modifiers & Flags.ABSTRACT) != 0)) this.scope.problemReporter().methodNeedingNoBody(this); else if (this.binding == null || this.binding.isStatic() || (this.binding.declaringClass instanceof LocalTypeBinding) || returnsUndeclTypeVar) { // Cannot be static for one of the reasons stated above @@ -377,9 +379,9 @@ else if (this.binding == null || this.binding.isStatic() || (this.binding.declar break; case TypeDeclaration.INTERFACE_DECL : if (compilerOptions.sourceLevel >= ClassFileConstants.JDK1_8 - && (this.modifiers & (ExtraCompilerModifiers.AccSemicolonBody | ClassFileConstants.AccAbstract)) == ExtraCompilerModifiers.AccSemicolonBody) { - boolean isPrivateMethod = compilerOptions.sourceLevel >= ClassFileConstants.JDK9 && (this.modifiers & ClassFileConstants.AccPrivate) != 0; - if (isPrivateMethod || ((this.modifiers & (ClassFileConstants.AccStatic | ExtraCompilerModifiers.AccDefaultMethod)) != 0)) { + && (this.modifiers & (ExtraCompilerModifiers.AccSemicolonBody | Flags.ABSTRACT)) == ExtraCompilerModifiers.AccSemicolonBody) { + boolean isPrivateMethod = compilerOptions.sourceLevel >= ClassFileConstants.JDK9 && (this.modifiers & Flags.PRIVATE) != 0; + if (isPrivateMethod || ((this.modifiers & (Flags.STATIC | ExtraCompilerModifiers.AccDefaultMethod)) != 0)) { this.scope.problemReporter().methodNeedBody(this); } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleDeclaration.java index b6a089d65b2..8dbceedd009 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ModuleDeclaration.java @@ -14,7 +14,9 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.ast; -import static org.eclipse.jdt.internal.compiler.problem.ProblemSeverities.*; +import static org.eclipse.jdt.internal.compiler.problem.ProblemSeverities.AbortCompilation; +import static org.eclipse.jdt.internal.compiler.problem.ProblemSeverities.AbortCompilationUnit; +import static org.eclipse.jdt.internal.compiler.problem.ProblemSeverities.AbortMethod; import java.util.Collection; import java.util.HashMap; @@ -46,6 +48,8 @@ import org.eclipse.jdt.internal.compiler.problem.AbortType; import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; +import com.sun.tools.javac.code.Flags; + public class ModuleDeclaration extends ASTNode implements ReferenceContext { public ExportsStatement[] exports; @@ -69,7 +73,7 @@ public class ModuleDeclaration extends ASTNode implements ReferenceContext { public char[][] tokens; public char[] moduleName; public long[] sourcePositions; - public int modifiers = ClassFileConstants.AccDefault; + public int modifiers = 0; boolean ignoreFurtherInvestigation; boolean hasResolvedModuleDirectives; boolean hasResolvedPackageDirectives; @@ -94,12 +98,12 @@ public ModuleBinding setBinding(SourceModuleBinding sourceModuleBinding) { public void checkAndSetModifiers() { int realModifiers = this.modifiers & ExtraCompilerModifiers.AccJustFlag; - int expectedModifiers = ClassFileConstants.ACC_OPEN | ClassFileConstants.ACC_SYNTHETIC; + int expectedModifiers = ClassFileConstants.ACC_OPEN | Flags.SYNTHETIC; if ((realModifiers & ~(expectedModifiers)) != 0) { this.scope.problemReporter().illegalModifierForModule(this); realModifiers &= expectedModifiers; } - int effectiveModifiers = ClassFileConstants.AccModule | realModifiers; + int effectiveModifiers = Flags.ACC_MODULE | realModifiers; this.modifiers = this.binding.modifiers = effectiveModifiers; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NameReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NameReference.java index 923a5562acb..e65a46249a9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NameReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NameReference.java @@ -21,7 +21,14 @@ import java.util.function.Predicate; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.InferenceContext18; +import org.eclipse.jdt.internal.compiler.lookup.InvocationSite; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; import org.eclipse.jdt.internal.compiler.problem.AbortMethod; public abstract class NameReference extends Reference implements InvocationSite { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java index 8362d6eb86b..7cb6a0e24cf 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NormalAnnotation.java @@ -14,7 +14,10 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair; /** * Normal annotation node diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullLiteral.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullLiteral.java index 7ea8ca36601..97ab14148f3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullLiteral.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/NullLiteral.java @@ -16,11 +16,12 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.codegen.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.flow.FlowContext; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class NullLiteral extends MagicLiteral { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java index 935ab1b932f..5970ab2e4cd 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/OR_OR_Expression.java @@ -20,10 +20,15 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; //dedicated treatment for the || public class OR_OR_Expression extends BinaryExpression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java index a1746d1ea2b..4d6fda09591 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java @@ -29,7 +29,16 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; /** * Syntactic representation of a reference to a generic type. diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java index 839bb3d8931..358013da202 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java @@ -29,7 +29,16 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; /** * Syntactic representation of a reference to a generic type. diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java index 8e2153996c4..a56f3913b36 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PostfixExpression.java @@ -14,8 +14,8 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; public class PostfixExpression extends CompoundAssignment { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java index 3ad6f433114..633274ed2c8 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/PrefixExpression.java @@ -14,7 +14,7 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; public class PrefixExpression extends CompoundAssignment { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java index d6c56a4814d..9ffc9f9d13d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedAllocationExpression.java @@ -73,6 +73,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; /** @@ -383,7 +384,7 @@ private TypeBinding resolveTypeForQualifiedAllocationExpression(BlockScope scope ReferenceBinding currentType = (ReferenceBinding)receiverType; do { // isStatic() is answering true for toplevel types - if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation; + if ((currentType.modifiers & Flags.STATIC) != 0) break checkParameterizedAllocation; if (currentType.isRawType()) break checkParameterizedAllocation; } while ((currentType = currentType.enclosingType())!= null); ParameterizedQualifiedTypeReference qRef = (ParameterizedQualifiedTypeReference) this.type; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java index 90c99bf2db0..e86d5c8e707 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedNameReference.java @@ -57,6 +57,7 @@ import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; public class QualifiedNameReference extends NameReference { @@ -790,7 +791,7 @@ public TypeBinding getOtherFieldBindings(BlockScope scope) { } if (field.isStatic()) { - if ((field.modifiers & ClassFileConstants.AccEnum) != 0 && scope.kind != Scope.MODULE_SCOPE) { + if ((field.modifiers & Flags.ENUM) != 0 && scope.kind != Scope.MODULE_SCOPE) { // enum constants are checked even when qualified -- modules don't contain field declarations ReferenceBinding declaringClass = field.original().declaringClass; MethodScope methodScope = scope.methodScope(); @@ -1064,7 +1065,7 @@ public TypeBinding resolveType(BlockScope scope) { } // check for forward references if (scope.kind != Scope.MODULE_SCOPE) { - if ((this.indexOfFirstFieldBinding == 1 || (fieldBinding.modifiers & ClassFileConstants.AccEnum) != 0 || (!fieldBinding.isFinal() && declaringClass.isEnum())) // enum constants are checked even when qualified + if ((this.indexOfFirstFieldBinding == 1 || (fieldBinding.modifiers & Flags.ENUM) != 0 || (!fieldBinding.isFinal() && declaringClass.isEnum())) // enum constants are checked even when qualified && TypeBinding.equalsEquals(sourceType, declaringClass) && methodScope.lastVisibleFieldID >= 0 && fieldBinding.id >= methodScope.lastVisibleFieldID diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java index 37e193dd93f..da9acef40e9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedThisReference.java @@ -20,10 +20,16 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class QualifiedThisReference extends ThisReference { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java index 856fe9c3deb..27c498b178b 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/QualifiedTypeReference.java @@ -16,7 +16,18 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.PackageBinding; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons; +import org.eclipse.jdt.internal.compiler.lookup.ProblemReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SplitPackageBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; public class QualifiedTypeReference extends TypeReference { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java index bc910fd34cc..d3dcdf406ba 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RecordComponent.java @@ -14,12 +14,22 @@ package org.eclipse.jdt.internal.compiler.ast; import java.util.List; + import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.ast.TypeReference.AnnotationCollector; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.AnnotationContext; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; + +import com.sun.tools.javac.code.Flags; public class RecordComponent extends AbstractVariableDeclaration { @@ -54,7 +64,7 @@ public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, Fl public void checkModifiers() { //only potential valid modifier is <> - if (((this.modifiers & ExtraCompilerModifiers.AccJustFlag) & ~ClassFileConstants.AccFinal) != 0) + if (((this.modifiers & ExtraCompilerModifiers.AccJustFlag) & ~Flags.FINAL) != 0) //AccModifierProblem -> other (non-visibility problem) //AccAlternateModifierProblem -> duplicate modifier //AccModifierProblem | AccAlternateModifierProblem -> visibility problem" diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java index 628026c4d7f..64f6e29c94f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReferenceExpression.java @@ -49,6 +49,7 @@ import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.INVOCATION_CONTEXT; import java.util.HashMap; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.CompilationResult; @@ -662,7 +663,7 @@ public TypeBinding resolveType(BlockScope scope) { if (isMethodReference() && this.haveReceiver && (this.original == this)) { this.receiverVariable = new LocalVariableBinding( (SecretReceiverVariableName + this.nameSourceStart).toCharArray(), this.lhs.resolvedType, - ClassFileConstants.AccDefault, false); + 0, false); scope.addLocalVariable(this.receiverVariable); this.receiverVariable.setConstant(Constant.NotAConstant); // not inlinable this.receiverVariable.useFlag = LocalVariableBinding.USED; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RequiresStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RequiresStatement.java index ea1b95d4628..d9a464547ce 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RequiresStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/RequiresStatement.java @@ -22,7 +22,7 @@ public class RequiresStatement extends ModuleStatement { public ModuleReference module; public ModuleBinding resolvedBinding; - public int modifiers = ClassFileConstants.AccDefault; + public int modifiers = 0; public int modifiersSourceStart; public RequiresStatement(ModuleReference module) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java index 5d1409c8a56..48cfc9785ff 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/ReturnStatement.java @@ -45,10 +45,20 @@ import static org.eclipse.jdt.internal.compiler.ast.ExpressionContext.ASSIGNMENT_CONTEXT; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext; +import org.eclipse.jdt.internal.compiler.flow.InsideSubRoutineFlowContext; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public class ReturnStatement extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java index 19369242886..c9c2a98c605 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleMemberAnnotation.java @@ -16,7 +16,9 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ElementValuePair; /** * SingleMemberAnnotation node diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java index f073eb5af88..dfe7e3787b4 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleNameReference.java @@ -55,6 +55,7 @@ import org.eclipse.jdt.internal.compiler.problem.AbortMethod; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; public class SingleNameReference extends NameReference implements OperatorIds { @@ -1080,7 +1081,7 @@ public TypeBinding resolveType(BlockScope scope) { private void checkLocalStaticClassVariables(BlockScope scope, VariableBinding variable) { if (this.actualReceiverType.isStatic() && this.actualReceiverType.isLocalType()) { - if ((variable.modifiers & ClassFileConstants.AccStatic) == 0 && + if ((variable.modifiers & Flags.STATIC) == 0 && (this.bits & ASTNode.IsCapturedOuterLocal) != 0) { BlockScope declaringScope = ((LocalVariableBinding) this.binding).declaringScope; MethodScope declaringMethodScope = declaringScope instanceof MethodScope ? (MethodScope)declaringScope : diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java index a251e726ed5..d805a8ab4e8 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SingleTypeReference.java @@ -18,7 +18,16 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; public class SingleTypeReference extends TypeReference { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Statement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Statement.java index 34295834c2b..d12c944bb09 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Statement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Statement.java @@ -47,10 +47,24 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.ast.NullAnnotationMatching.CheckMode; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; public abstract class Statement extends ASTNode { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java index d9191d11f61..eff15260e6b 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchExpression.java @@ -28,7 +28,6 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.flow.FlowContext; import org.eclipse.jdt.internal.compiler.flow.FlowInfo; @@ -250,7 +249,7 @@ private LocalVariableBinding addTypeStackVariable(CodeStream codeStream, TypeBin new LocalVariableBinding( name, type, - ClassFileConstants.AccDefault, + 0, false); lvb.setConstant(Constant.NotAConstant); lvb.useFlag = LocalVariableBinding.USED; @@ -643,7 +642,7 @@ protected void addSecretTryResultVariable() { new LocalVariableBinding( SwitchExpression.SECRET_YIELD_VALUE_NAME, null, - ClassFileConstants.AccDefault, + 0, false); this.hiddenYield.setConstant(Constant.NotAConstant); this.hiddenYield.useFlag = LocalVariableBinding.USED; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java index 99a327545e2..9bb6ee1d05d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/SwitchStatement.java @@ -50,6 +50,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; @SuppressWarnings("rawtypes") @@ -907,7 +908,7 @@ public void resolve(BlockScope upperScope) { // the secret variable should be created before iterating over the switch's statements that could // create more locals. This must be done to prevent overlapping of locals // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=356002 - this.dispatchStringCopy = new LocalVariableBinding(SecretStringVariableName, upperScope.getJavaLangString(), ClassFileConstants.AccDefault, false); + this.dispatchStringCopy = new LocalVariableBinding(SecretStringVariableName, upperScope.getJavaLangString(), 0, false); upperScope.addLocalVariable(this.dispatchStringCopy); this.dispatchStringCopy.setConstant(Constant.NotAConstant); this.dispatchStringCopy.useFlag = LocalVariableBinding.USED; @@ -1076,7 +1077,7 @@ public void resolve(BlockScope upperScope) { FieldBinding[] enumFields = ((ReferenceBinding)expressionType.erasure()).fields(); for (int i = 0, max = enumFields.length; i 0) { resourceManagementScope = new BlockScope(this.scope); this.primaryExceptionVariable = - new LocalVariableBinding(TryStatement.SECRET_PRIMARY_EXCEPTION_VARIABLE_NAME, this.scope.getJavaLangThrowable(), ClassFileConstants.AccDefault, false); + new LocalVariableBinding(TryStatement.SECRET_PRIMARY_EXCEPTION_VARIABLE_NAME, this.scope.getJavaLangThrowable(), 0, false); resourceManagementScope.addLocalVariable(this.primaryExceptionVariable); this.primaryExceptionVariable.setConstant(Constant.NotAConstant); // not inlinable this.caughtThrowableVariable = - new LocalVariableBinding(TryStatement.SECRET_CAUGHT_THROWABLE_VARIABLE_NAME, this.scope.getJavaLangThrowable(), ClassFileConstants.AccDefault, false); + new LocalVariableBinding(TryStatement.SECRET_CAUGHT_THROWABLE_VARIABLE_NAME, this.scope.getJavaLangThrowable(), 0, false); resourceManagementScope.addLocalVariable(this.caughtThrowableVariable); this.caughtThrowableVariable.setConstant(Constant.NotAConstant); // not inlinable } @@ -1127,7 +1151,7 @@ public void resolve(BlockScope upperScope) { LocalDeclaration node = (LocalDeclaration)this.resources[i]; LocalVariableBinding localVariableBinding = node.binding; if (localVariableBinding != null && localVariableBinding.isValidBinding()) { - localVariableBinding.modifiers |= ClassFileConstants.AccFinal; + localVariableBinding.modifiers |= Flags.FINAL; localVariableBinding.tagBits |= TagBits.IsResource; TypeBinding resourceType = localVariableBinding.type; if (resourceType instanceof ReferenceBinding) { @@ -1170,14 +1194,14 @@ public void resolve(BlockScope upperScope) { // the type does not matter as long as it is not a base type if (!upperScope.compilerOptions().inlineJsrBytecode) { this.returnAddressVariable = - new LocalVariableBinding(TryStatement.SECRET_RETURN_ADDRESS_NAME, upperScope.getJavaLangObject(), ClassFileConstants.AccDefault, false); + new LocalVariableBinding(TryStatement.SECRET_RETURN_ADDRESS_NAME, upperScope.getJavaLangObject(), 0, false); finallyScope.addLocalVariable(this.returnAddressVariable); this.returnAddressVariable.setConstant(Constant.NotAConstant); // not inlinable } this.subRoutineStartLabel = new BranchLabel(); this.anyExceptionVariable = - new LocalVariableBinding(TryStatement.SECRET_ANY_HANDLER_NAME, this.scope.getJavaLangThrowable(), ClassFileConstants.AccDefault, false); + new LocalVariableBinding(TryStatement.SECRET_ANY_HANDLER_NAME, this.scope.getJavaLangThrowable(), 0, false); finallyScope.addLocalVariable(this.anyExceptionVariable); this.anyExceptionVariable.setConstant(Constant.NotAConstant); // not inlinable @@ -1192,7 +1216,7 @@ public void resolve(BlockScope upperScope) { new LocalVariableBinding( TryStatement.SECRET_RETURN_VALUE_NAME, methodReturnType, - ClassFileConstants.AccDefault, + 0, false); finallyScope.addLocalVariable(this.secretReturnValue); this.secretReturnValue.setConstant(Constant.NotAConstant); // not inlinable diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java index 85b304d61e8..659cdbb9530 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java @@ -33,18 +33,55 @@ import java.util.Set; import java.util.stream.Collectors; -import org.eclipse.jdt.core.compiler.*; -import org.eclipse.jdt.internal.compiler.*; -import org.eclipse.jdt.internal.compiler.impl.*; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.core.compiler.IProblem; +import org.eclipse.jdt.internal.compiler.ASTVisitor; +import org.eclipse.jdt.internal.compiler.ClassFile; +import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; -import org.eclipse.jdt.internal.compiler.parser.*; -import org.eclipse.jdt.internal.compiler.problem.*; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.InitializationFlowContext; +import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; +import org.eclipse.jdt.internal.compiler.impl.StringConstant; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope; +import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.MemberTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.RecordComponentBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; +import org.eclipse.jdt.internal.compiler.parser.Parser; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; +import org.eclipse.jdt.internal.compiler.problem.AbortCompilationUnit; +import org.eclipse.jdt.internal.compiler.problem.AbortMethod; +import org.eclipse.jdt.internal.compiler.problem.AbortType; +import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; import org.eclipse.jdt.internal.compiler.util.SimpleSetOfCharArray; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + public class TypeDeclaration extends Statement implements ProblemSeverities, ReferenceContext { // Type decl kinds public static final int CLASS_DECL = 1; @@ -56,7 +93,7 @@ public class TypeDeclaration extends Statement implements ProblemSeverities, Ref */ public static final int RECORD_DECL = 5; - public int modifiers = ClassFileConstants.AccDefault; + public int modifiers = 0; public int modifiersSourceStart; public int functionalExpressionsCount = 0; public Annotation[] annotations; @@ -180,13 +217,13 @@ public MethodDeclaration addMissingAbstractMethodFor(MethodBinding methodBinding methodDeclaration.selector = methodBinding.selector; methodDeclaration.sourceStart = this.sourceStart; methodDeclaration.sourceEnd = this.sourceEnd; - methodDeclaration.modifiers = methodBinding.getAccessFlags() & ~ClassFileConstants.AccAbstract; + methodDeclaration.modifiers = methodBinding.getAccessFlags() & ~Flags.ABSTRACT; if (argumentsLength > 0) { String baseName = "arg";//$NON-NLS-1$ Argument[] arguments = (methodDeclaration.arguments = new Argument[argumentsLength]); for (int i = argumentsLength; --i >= 0;) { - arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, ClassFileConstants.AccDefault); + arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, 0); } } @@ -207,7 +244,7 @@ public MethodDeclaration addMissingAbstractMethodFor(MethodBinding methodBinding //============BINDING UPDATE========================== methodDeclaration.binding = new MethodBinding( - methodDeclaration.modifiers | ClassFileConstants.AccSynthetic, //methodDeclaration + methodDeclaration.modifiers | Flags.SYNTHETIC, //methodDeclaration methodBinding.selector, methodBinding.returnType, argumentsLength == 0 ? Binding.NO_PARAMETERS : argumentTypes, //arguments bindings @@ -365,8 +402,8 @@ public ConstructorDeclaration createDefaultConstructorForRecord(boolean needExpl constructor.bits |= ASTNode.IsCanonicalConstructor | ASTNode.IsImplicit; constructor.selector = this.name; constructor.modifiers = this.modifiers & ExtraCompilerModifiers.AccVisibilityMASK; -// constructor.modifiers = this.modifiers & ClassFileConstants.AccPublic; -// constructor.modifiers |= ClassFileConstants.AccPublic; // JLS 14 8.10.5 +// constructor.modifiers = this.modifiers & Flags.PUBLIC; +// constructor.modifiers |= Flags.PUBLIC; // JLS 14 8.10.5 constructor.arguments = getArgumentsFromComponents(this.recordComponents); for (int i = 0, max = constructor.arguments.length; i < max; i++) { @@ -499,7 +536,7 @@ public MethodBinding createDefaultConstructorWithBinding(MethodBinding inherited constructor.sourceEnd = this.sourceEnd; int newModifiers = this.modifiers & ExtraCompilerModifiers.AccVisibilityMASK; if (inheritedConstructorBinding.isVarargs()) { - newModifiers |= ClassFileConstants.AccVarargs; + newModifiers |= Flags.ACC_VARARGS; } constructor.modifiers = newModifiers; constructor.bits |= ASTNode.IsDefaultConstructor; @@ -507,7 +544,7 @@ public MethodBinding createDefaultConstructorWithBinding(MethodBinding inherited if (argumentsLength > 0) { Argument[] arguments = (constructor.arguments = new Argument[argumentsLength]); for (int i = argumentsLength; --i >= 0;) { - arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, ClassFileConstants.AccDefault); + arguments[i] = new Argument((baseName + i).toCharArray(), 0L, null /*type ref*/, 0); } } //the super call inside the constructor @@ -1011,12 +1048,12 @@ private char[] getValueAsChars(Expression value) { } public final static int kind(int flags) { - switch (flags & (ClassFileConstants.AccInterface|ClassFileConstants.AccAnnotation|ClassFileConstants.AccEnum|ExtraCompilerModifiers.AccRecord)) { - case ClassFileConstants.AccInterface : + switch (flags & (Flags.INTERFACE|Flags.ANNOTATION|Flags.ENUM|ExtraCompilerModifiers.AccRecord)) { + case Flags.INTERFACE : return TypeDeclaration.INTERFACE_DECL; - case ClassFileConstants.AccInterface|ClassFileConstants.AccAnnotation : + case Flags.INTERFACE|Flags.ANNOTATION : return TypeDeclaration.ANNOTATION_TYPE_DECL; - case ClassFileConstants.AccEnum : + case Flags.ENUM : return TypeDeclaration.ENUM_DECL; case ExtraCompilerModifiers.AccRecord : return TypeDeclaration.RECORD_DECL; @@ -1115,7 +1152,7 @@ public final boolean needClassInitMethod() { for (int i = this.fields.length; --i >= 0;) { FieldDeclaration field = this.fields[i]; //need to test the modifier directly while there is no binding yet - if ((field.modifiers & ClassFileConstants.AccStatic) != 0) + if ((field.modifiers & Flags.STATIC) != 0) return true; // TODO (philippe) shouldn't it check whether field is initializer or has some initial value ? } } @@ -1355,7 +1392,7 @@ public void resolve() { methodBinding = sourceType.getExactMethod(TypeConstants.WRITEOBJECT, new TypeBinding[] { argumentTypeBinding }, compilationUnitScope); hasWriteObjectMethod = methodBinding != null && methodBinding.isValidBinding() - && methodBinding.modifiers == ClassFileConstants.AccPrivate + && methodBinding.modifiers == Flags.PRIVATE && methodBinding.returnType == TypeBinding.VOID && (throwsExceptions = methodBinding.thrownExceptions).length == 1 && throwsExceptions[0].id == TypeIds.T_JavaIoException; @@ -1365,7 +1402,7 @@ public void resolve() { methodBinding = sourceType.getExactMethod(TypeConstants.READOBJECT, new TypeBinding[] { argumentTypeBinding }, compilationUnitScope); hasReadObjectMethod = methodBinding != null && methodBinding.isValidBinding() - && methodBinding.modifiers == ClassFileConstants.AccPrivate + && methodBinding.modifiers == Flags.PRIVATE && methodBinding.returnType == TypeBinding.VOID && (throwsExceptions = methodBinding.thrownExceptions).length == 1 && throwsExceptions[0].id == TypeIds.T_JavaIoException; @@ -1425,7 +1462,7 @@ public void resolve() { continue; } if (needSerialVersion - && ((fieldBinding.modifiers & (ClassFileConstants.AccStatic | ClassFileConstants.AccFinal)) == (ClassFileConstants.AccStatic | ClassFileConstants.AccFinal)) + && ((fieldBinding.modifiers & (Flags.STATIC | Flags.FINAL)) == (Flags.STATIC | Flags.FINAL)) && CharOperation.equals(TypeConstants.SERIALVERSIONUID, fieldBinding.name) && TypeBinding.equalsEquals(TypeBinding.LONG, fieldBinding.type)) { needSerialVersion = false; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypePattern.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypePattern.java index f977b11f7c1..4188bb7f308 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypePattern.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/TypePattern.java @@ -18,7 +18,6 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.flow.FlowContext; @@ -249,7 +248,7 @@ protected void initSecretPatternVariable(BlockScope scope) { new LocalVariableBinding( SECRET_PATTERN_VARIABLE_NAME, this.resolvedType, - ClassFileConstants.AccDefault, + 0, false); l.setConstant(Constant.NotAConstant); l.useFlag = LocalVariableBinding.USED; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java index 46fd40dba2e..07ce566fa80 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/UnaryExpression.java @@ -17,11 +17,16 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.impl.BooleanConstant; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class UnaryExpression extends OperatorExpression { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java index f816d5ad6fd..d7ea12db9b7 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/WhileStatement.java @@ -20,11 +20,16 @@ package org.eclipse.jdt.internal.compiler.ast; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.impl.*; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.codegen.*; -import org.eclipse.jdt.internal.compiler.flow.*; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.codegen.BranchLabel; +import org.eclipse.jdt.internal.compiler.codegen.CodeStream; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.LoopingFlowContext; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class WhileStatement extends Statement { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Wildcard.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Wildcard.java index 15caa6a312f..540063e08a6 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Wildcard.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/Wildcard.java @@ -23,7 +23,13 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; /** * Node to represent Wildcard diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java index 2665aade700..6dcb2c1934a 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/ast/YieldStatement.java @@ -16,9 +16,14 @@ import org.eclipse.jdt.internal.compiler.ASTVisitor; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; -import org.eclipse.jdt.internal.compiler.flow.*; +import org.eclipse.jdt.internal.compiler.flow.FlowContext; +import org.eclipse.jdt.internal.compiler.flow.FlowInfo; +import org.eclipse.jdt.internal.compiler.flow.InsideSubRoutineFlowContext; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class YieldStatement extends BranchStatement { @@ -110,7 +115,7 @@ protected void addSecretYieldResultValue(BlockScope scope1) { LocalVariableBinding local = new LocalVariableBinding( YieldStatement.SECRET_YIELD_RESULT_VALUE_NAME, se.resolvedType, - ClassFileConstants.AccDefault, + 0, false); local.setConstant(Constant.NotAConstant); local.useFlag = LocalVariableBinding.USED; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java index 1442f9477ce..f1891c54dd3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathDirectory.java @@ -17,6 +17,23 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.batch; +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.nio.file.FileSystems; +import java.nio.file.FileVisitResult; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.SimpleFileVisitor; +import java.nio.file.attribute.BasicFileAttributes; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Function; +import java.util.stream.Stream; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.CompilationResult; import org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies; @@ -36,23 +53,6 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; import org.eclipse.jdt.internal.compiler.util.Util; -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.nio.file.FileSystems; -import java.nio.file.FileVisitResult; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.SimpleFileVisitor; -import java.nio.file.attribute.BasicFileAttributes; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.function.Function; -import java.util.stream.Stream; - @SuppressWarnings({"rawtypes", "unchecked"}) public class ClasspathDirectory extends ClasspathLocation { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java index 6bf1dd2053e..c00399c7170 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJar.java @@ -35,11 +35,11 @@ import org.eclipse.jdt.internal.compiler.classfmt.ExternalAnnotationDecorator; import org.eclipse.jdt.internal.compiler.classfmt.ExternalAnnotationProvider; import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; +import org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.eclipse.jdt.internal.compiler.env.IModule; import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; -import org.eclipse.jdt.internal.compiler.env.IBinaryType; -import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.util.ManifestAnalyzer; import org.eclipse.jdt.internal.compiler.util.SuffixConstants; import org.eclipse.jdt.internal.compiler.util.Util; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJmod.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJmod.java index 7334d2bec25..b25bc9b2934 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJmod.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathJmod.java @@ -28,9 +28,9 @@ import org.eclipse.jdt.internal.compiler.classfmt.ExternalAnnotationDecorator; import org.eclipse.jdt.internal.compiler.classfmt.ExternalAnnotationProvider; import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; +import org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.eclipse.jdt.internal.compiler.env.IModule; import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; -import org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus; import org.eclipse.jdt.internal.compiler.util.SuffixConstants; import org.eclipse.jdt.internal.compiler.util.Util; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java index d906d7bb4ba..a7ec4b947a0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ClasspathSourceJar.java @@ -14,8 +14,8 @@ package org.eclipse.jdt.internal.compiler.batch; import java.io.File; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.util.zip.ZipEntry; import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java index c511fc12765..87e355f4f8c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/FileSystem.java @@ -40,18 +40,18 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ExternalAnnotationDecorator; import org.eclipse.jdt.internal.compiler.env.AccessRuleSet; -import org.eclipse.jdt.internal.compiler.env.IModulePathEntry; import org.eclipse.jdt.internal.compiler.env.IModule; import org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; +import org.eclipse.jdt.internal.compiler.env.IModulePathEntry; +import org.eclipse.jdt.internal.compiler.env.IUpdatableModule; +import org.eclipse.jdt.internal.compiler.env.IUpdatableModule.UpdateKind; +import org.eclipse.jdt.internal.compiler.env.IUpdatableModule.UpdatesByKind; import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; +import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.lookup.ModuleBinding; import org.eclipse.jdt.internal.compiler.parser.Parser; import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; -import org.eclipse.jdt.internal.compiler.env.IUpdatableModule; -import org.eclipse.jdt.internal.compiler.env.IUpdatableModule.UpdateKind; -import org.eclipse.jdt.internal.compiler.env.IUpdatableModule.UpdatesByKind; -import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.util.JRTUtil; import org.eclipse.jdt.internal.compiler.util.SuffixConstants; import org.eclipse.jdt.internal.compiler.util.Util; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java index fb61cdcb3ed..5f85403d18b 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/batch/ModuleFinder.java @@ -31,8 +31,8 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; import org.eclipse.jdt.internal.compiler.env.IModule; -import org.eclipse.jdt.internal.compiler.env.PackageExportImpl; import org.eclipse.jdt.internal.compiler.env.IModule.IPackageExport; +import org.eclipse.jdt.internal.compiler.env.PackageExportImpl; import org.eclipse.jdt.internal.compiler.parser.Parser; import org.eclipse.jdt.internal.compiler.util.JRTUtil; import org.eclipse.jdt.internal.compiler.util.Util; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java index 9c85ef424c5..72fcb9313d8 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java @@ -19,8 +19,19 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; -import org.eclipse.jdt.internal.compiler.env.*; -import org.eclipse.jdt.internal.compiler.impl.*; +import org.eclipse.jdt.internal.compiler.env.ClassSignature; +import org.eclipse.jdt.internal.compiler.env.EnumConstantSignature; +import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; +import org.eclipse.jdt.internal.compiler.env.IBinaryElementValuePair; +import org.eclipse.jdt.internal.compiler.impl.BooleanConstant; +import org.eclipse.jdt.internal.compiler.impl.ByteConstant; +import org.eclipse.jdt.internal.compiler.impl.CharConstant; +import org.eclipse.jdt.internal.compiler.impl.DoubleConstant; +import org.eclipse.jdt.internal.compiler.impl.FloatConstant; +import org.eclipse.jdt.internal.compiler.impl.IntConstant; +import org.eclipse.jdt.internal.compiler.impl.LongConstant; +import org.eclipse.jdt.internal.compiler.impl.ShortConstant; +import org.eclipse.jdt.internal.compiler.impl.StringConstant; import org.eclipse.jdt.internal.compiler.lookup.TagBits; import org.eclipse.jdt.internal.compiler.util.Util; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java index a231d0ac035..6c66b7db877 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileConstants.java @@ -25,47 +25,12 @@ public interface ClassFileConstants { - int AccDefault = 0; - /* - * Modifiers - */ - int AccPublic = 0x0001; - int AccPrivate = 0x0002; - int AccProtected = 0x0004; - int AccStatic = 0x0008; - int AccFinal = 0x0010; - int AccSynchronized = 0x0020; - int AccVolatile = 0x0040; - int AccBridge = 0x0040; - int AccTransient = 0x0080; - int AccVarargs = 0x0080; - int AccNative = 0x0100; - int AccInterface = 0x0200; - int AccAbstract = 0x0400; - int AccStrictfp = 0x0800; - int AccSynthetic = 0x1000; - int AccAnnotation = 0x2000; - int AccEnum = 0x4000; - int AccModule = 0x8000; - - /** - * From classfile version 52 (compliance 1.8 up), meaning that a formal parameter is mandated - * by a language specification, so all compilers for the language must emit it. - */ - int AccMandated = 0x8000; - /** * Flags in module declaration - since java9 */ int ACC_OPEN = 0x0020; int ACC_TRANSITIVE = 0x0020; int ACC_STATIC_PHASE = 0x0040; - int ACC_SYNTHETIC = 0x1000; - - /** - * Other VM flags. - */ - int AccSuper = 0x0020; /** * Extra flags for types and members attributes (not from the JVMS, should have been defined in ExtraCompilerModifiers). diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java index f7a5cbd5465..3f7b98e9cd0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ClassFileReader.java @@ -50,6 +50,7 @@ import org.eclipse.jdt.internal.compiler.util.JRTUtil; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ClassFile; public class ClassFileReader extends ClassFileStruct implements IBinaryType { @@ -96,12 +97,12 @@ private static String printTypeModifiers(int modifiers) { java.io.StringWriter out = new java.io.StringWriter(); java.io.PrintWriter print = new java.io.PrintWriter(out); - if ((modifiers & ClassFileConstants.AccPublic) != 0) print.print("public "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccPrivate) != 0) print.print("private "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccFinal) != 0) print.print("final "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccSuper) != 0) print.print("super "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccInterface) != 0) print.print("interface "); //$NON-NLS-1$ - if ((modifiers & ClassFileConstants.AccAbstract) != 0) print.print("abstract "); //$NON-NLS-1$ + if ((modifiers & Flags.PUBLIC) != 0) print.print("public "); //$NON-NLS-1$ + if ((modifiers & Flags.PRIVATE) != 0) print.print("private "); //$NON-NLS-1$ + if ((modifiers & Flags.FINAL) != 0) print.print("final "); //$NON-NLS-1$ + if ((modifiers & Flags.ACC_SUPER) != 0) print.print("super "); //$NON-NLS-1$ + if ((modifiers & Flags.INTERFACE) != 0) print.print("interface "); //$NON-NLS-1$ + if ((modifiers & Flags.ABSTRACT) != 0) print.print("abstract "); //$NON-NLS-1$ if ((modifiers & ExtraCompilerModifiers.AccSealed) != 0) print.print("sealed "); //$NON-NLS-1$ print.flush(); return out.toString(); @@ -356,7 +357,7 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit readOffset += 2; if (this.methodsCount != 0) { this.methods = new MethodInfo[this.methodsCount]; - boolean isAnnotationType = (this.accessFlags & ClassFileConstants.AccAnnotation) != 0; + boolean isAnnotationType = (this.accessFlags & Flags.ANNOTATION) != 0; for (int i = 0; i < this.methodsCount; i++) { this.methods[i] = isAnnotationType ? AnnotationMethodInfo.createAnnotationMethod(this.reference, this.constantPoolOffsets, readOffset, this.version) @@ -427,7 +428,7 @@ public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInit break; case 'y' : if (CharOperation.equals(attributeName, AttributeNamesConstants.SyntheticName)) { - this.accessFlags |= ClassFileConstants.AccSynthetic; + this.accessFlags |= Flags.SYNTHETIC; } break; case 'i' : @@ -899,7 +900,7 @@ public int getModifiers() { if (this.innerInfo != null) { modifiers = this.innerInfo.getModifiers() | (this.accessFlags & ClassFileConstants.AccDeprecated) - | (this.accessFlags & ClassFileConstants.AccSynthetic); + | (this.accessFlags & Flags.SYNTHETIC); } else { modifiers = this.accessFlags; } @@ -1487,7 +1488,7 @@ public boolean isStaticInner(char[] innerTypeName) { if (this.innerInfos != null) { for (InnerClassInfo innerClassInfo : this.innerInfos) { if (Arrays.equals(innerTypeName, innerClassInfo.getName())) { - return (innerClassInfo.getModifiers() & ClassFileConstants.AccStatic) != 0; + return (innerClassInfo.getModifiers() & Flags.STATIC) != 0; } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java index 330d35f9dba..5181e42cfa1 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/ExternalAnnotationProvider.java @@ -15,6 +15,26 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.classfmt; +import static org.eclipse.jdt.internal.compiler.util.Util.C_ARRAY; +import static org.eclipse.jdt.internal.compiler.util.Util.C_BOOLEAN; +import static org.eclipse.jdt.internal.compiler.util.Util.C_BYTE; +import static org.eclipse.jdt.internal.compiler.util.Util.C_CAPTURE; +import static org.eclipse.jdt.internal.compiler.util.Util.C_CHAR; +import static org.eclipse.jdt.internal.compiler.util.Util.C_DOUBLE; +import static org.eclipse.jdt.internal.compiler.util.Util.C_EXTENDS; +import static org.eclipse.jdt.internal.compiler.util.Util.C_FLOAT; +import static org.eclipse.jdt.internal.compiler.util.Util.C_GENERIC_END; +import static org.eclipse.jdt.internal.compiler.util.Util.C_GENERIC_START; +import static org.eclipse.jdt.internal.compiler.util.Util.C_INT; +import static org.eclipse.jdt.internal.compiler.util.Util.C_LONG; +import static org.eclipse.jdt.internal.compiler.util.Util.C_RESOLVED; +import static org.eclipse.jdt.internal.compiler.util.Util.C_SHORT; +import static org.eclipse.jdt.internal.compiler.util.Util.C_STAR; +import static org.eclipse.jdt.internal.compiler.util.Util.C_SUPER; +import static org.eclipse.jdt.internal.compiler.util.Util.C_TYPE_VARIABLE; +import static org.eclipse.jdt.internal.compiler.util.Util.C_UNRESOLVED; +import static org.eclipse.jdt.internal.compiler.util.Util.C_VOID; + import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; @@ -32,8 +52,6 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.util.Util; -import static org.eclipse.jdt.internal.compiler.util.Util.*; - public class ExternalAnnotationProvider { public static final String ANNOTATION_FILE_EXTENSION= "eea"; //$NON-NLS-1$ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java index 9e889b94b00..08f875d2cc9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/FieldInfo.java @@ -20,11 +20,21 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; import org.eclipse.jdt.internal.compiler.env.IBinaryField; import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation; -import org.eclipse.jdt.internal.compiler.impl.*; +import org.eclipse.jdt.internal.compiler.impl.BooleanConstant; +import org.eclipse.jdt.internal.compiler.impl.ByteConstant; +import org.eclipse.jdt.internal.compiler.impl.CharConstant; +import org.eclipse.jdt.internal.compiler.impl.Constant; +import org.eclipse.jdt.internal.compiler.impl.DoubleConstant; +import org.eclipse.jdt.internal.compiler.impl.FloatConstant; +import org.eclipse.jdt.internal.compiler.impl.IntConstant; +import org.eclipse.jdt.internal.compiler.impl.LongConstant; +import org.eclipse.jdt.internal.compiler.impl.ShortConstant; +import org.eclipse.jdt.internal.compiler.impl.StringConstant; import org.eclipse.jdt.internal.compiler.lookup.TagBits; import org.eclipse.jdt.internal.compiler.lookup.TypeIds; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ClassFile; @SuppressWarnings("rawtypes") @@ -328,7 +338,7 @@ protected void initialize() { * @return boolean */ public boolean isSynthetic() { - return (getModifiers() & ClassFileConstants.AccSynthetic) != 0; + return (getModifiers() & Flags.SYNTHETIC) != 0; } private void readConstantAttribute() { int attributesCount = u2At(6); @@ -407,7 +417,7 @@ private void readModifierRelatedAttributes() { break; case 'S' : if (CharOperation.equals(attributeName, AttributeNamesConstants.SyntheticName)) - this.accessFlags |= ClassFileConstants.AccSynthetic; + this.accessFlags |= Flags.SYNTHETIC; break; } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java index 2c4bb07f6aa..3e41a0b471c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/classfmt/MethodInfo.java @@ -25,6 +25,8 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryTypeAnnotation; import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings("rawtypes") public class MethodInfo extends ClassFileStruct implements IBinaryMethod, Comparable { static private final char[][] noException = CharOperation.NO_CHAR_CHAR; @@ -371,7 +373,7 @@ public boolean isConstructor() { * @return boolean */ public boolean isSynthetic() { - return (getModifiers() & ClassFileConstants.AccSynthetic) != 0; + return (getModifiers() & Flags.SYNTHETIC) != 0; } private synchronized void readExceptionAttributes() { int attributesCount = u2At(6); @@ -424,7 +426,7 @@ private synchronized void readModifierRelatedAttributes() { break; case 'S' : if (CharOperation.equals(attributeName, AttributeNamesConstants.SyntheticName)) - flags |= ClassFileConstants.AccSynthetic; + flags |= Flags.SYNTHETIC; break; case 'A' : if (CharOperation.equals(attributeName, AttributeNamesConstants.AnnotationDefaultName)) @@ -432,7 +434,7 @@ private synchronized void readModifierRelatedAttributes() { break; case 'V' : if (CharOperation.equals(attributeName, AttributeNamesConstants.VarargsName)) - flags |= ClassFileConstants.AccVarargs; + flags |= Flags.ACC_VARARGS; } } readOffset += (6 + u4At(readOffset + 2)); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java index 85f120fb8ad..7468fda496e 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java @@ -58,10 +58,30 @@ import org.eclipse.jdt.internal.compiler.flow.UnconditionalFlowInfo; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; -import org.eclipse.jdt.internal.compiler.lookup.*; +import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; +import org.eclipse.jdt.internal.compiler.lookup.Binding; +import org.eclipse.jdt.internal.compiler.lookup.BlockScope; +import org.eclipse.jdt.internal.compiler.lookup.ClassScope; +import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; +import org.eclipse.jdt.internal.compiler.lookup.IntersectionTypeBinding18; +import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.MethodScope; +import org.eclipse.jdt.internal.compiler.lookup.NestedTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.Scope; +import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticArgumentBinding; +import org.eclipse.jdt.internal.compiler.lookup.SyntheticMethodBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; +import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; +import org.eclipse.jdt.internal.compiler.lookup.TypeIds; +import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; import org.eclipse.jdt.internal.compiler.problem.AbortMethod; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; @SuppressWarnings({"rawtypes", "unchecked"}) @@ -3351,7 +3371,7 @@ public void generateSyntheticBodyForSwitchTable(SyntheticMethodBinding methodBin if (fields != null) { for (int i = 0, max = fields.length; i < max; i++) { FieldBinding fieldBinding = fields[i]; - if ((fieldBinding.getAccessFlags() & ClassFileConstants.AccEnum) != 0) { + if ((fieldBinding.getAccessFlags() & Flags.ENUM) != 0) { final BranchLabel endLabel = new BranchLabel(this); final ExceptionLabel anyExceptionHandler = new ExceptionLabel(this, TypeBinding.LONG /* represents NoSuchFieldError*/); anyExceptionHandler.placeStart(); diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java index 7869a4b3b57..3473a9cbf3b 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java @@ -21,7 +21,23 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.codegen; -import static com.sun.tools.javac.jvm.ClassFile.*; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Class; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Double; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Dynamic; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Fieldref; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Float; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Integer; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_InterfaceMethodref; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_InvokeDynamic; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Long; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_MethodHandle; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_MethodType; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Methodref; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Module; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_NameandType; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Package; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_String; +import static com.sun.tools.javac.jvm.ClassFile.CONSTANT_Utf8; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ClassFile; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/MultiCatchExceptionLabel.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/MultiCatchExceptionLabel.java index 9ab7b3b2632..7f38686c5d3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/MultiCatchExceptionLabel.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/codegen/MultiCatchExceptionLabel.java @@ -17,8 +17,8 @@ package org.eclipse.jdt.internal.compiler.codegen; import org.eclipse.jdt.internal.compiler.ast.Annotation; -import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; import org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; public class MultiCatchExceptionLabel extends ExceptionLabel { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java index d6489465e9b..f392ccc9d94 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/flow/ExceptionHandlingFlowContext.java @@ -22,13 +22,13 @@ import java.util.Arrays; import java.util.List; -import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.Argument; -import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; import org.eclipse.jdt.internal.compiler.ast.SubRoutineStatement; import org.eclipse.jdt.internal.compiler.ast.TryStatement; import org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.eclipse.jdt.internal.compiler.ast.UnionTypeReference; import org.eclipse.jdt.internal.compiler.codegen.ObjectCache; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.CatchParameterBinding; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java index abb43982445..7a426c71c27 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java @@ -44,6 +44,8 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({ "rawtypes", "unchecked" }) public class CompilerOptions { @@ -1423,11 +1425,11 @@ public String getSeverityString(int irritant) { } public String getVisibilityString(int level) { switch (level & ExtraCompilerModifiers.AccVisibilityMASK) { - case ClassFileConstants.AccPublic: + case Flags.PUBLIC: return PUBLIC; - case ClassFileConstants.AccProtected: + case Flags.PROTECTED: return PROTECTED; - case ClassFileConstants.AccPrivate: + case Flags.PRIVATE: return PRIVATE; default: return DEFAULT; @@ -1515,19 +1517,19 @@ protected void resetDefaults() { this.reportUnavoidableGenericTypeProblems = true; // check javadoc comments tags - this.reportInvalidJavadocTagsVisibility = ClassFileConstants.AccPublic; + this.reportInvalidJavadocTagsVisibility = Flags.PUBLIC; this.reportInvalidJavadocTags = false; this.reportInvalidJavadocTagsDeprecatedRef = false; this.reportInvalidJavadocTagsNotVisibleRef = false; this.reportMissingJavadocTagDescription = RETURN_TAG; // check missing javadoc tags - this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccPublic; + this.reportMissingJavadocTagsVisibility = Flags.PUBLIC; this.reportMissingJavadocTagsOverriding = false; this.reportMissingJavadocTagsMethodTypeParameters = false; // check missing javadoc comments - this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccPublic; + this.reportMissingJavadocCommentsVisibility = Flags.PUBLIC; this.reportMissingJavadocCommentsOverriding = false; // JSR bytecode inlining and sharing @@ -1984,13 +1986,13 @@ && getSeverity(ExplicitlyClosedAutoCloseable) == ProblemSeverities.Ignore) { } if ( (optionValue = optionsMap.get(OPTION_ReportInvalidJavadocTagsVisibility)) != null) { if (PUBLIC.equals(optionValue)) { - this.reportInvalidJavadocTagsVisibility = ClassFileConstants.AccPublic; + this.reportInvalidJavadocTagsVisibility = Flags.PUBLIC; } else if (PROTECTED.equals(optionValue)) { - this.reportInvalidJavadocTagsVisibility = ClassFileConstants.AccProtected; + this.reportInvalidJavadocTagsVisibility = Flags.PROTECTED; } else if (DEFAULT.equals(optionValue)) { - this.reportInvalidJavadocTagsVisibility = ClassFileConstants.AccDefault; + this.reportInvalidJavadocTagsVisibility = 0; } else if (PRIVATE.equals(optionValue)) { - this.reportInvalidJavadocTagsVisibility = ClassFileConstants.AccPrivate; + this.reportInvalidJavadocTagsVisibility = Flags.PRIVATE; } } if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadocTags)) != null) { @@ -2019,13 +2021,13 @@ && getSeverity(ExplicitlyClosedAutoCloseable) == ProblemSeverities.Ignore) { } if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsVisibility)) != null) { if (PUBLIC.equals(optionValue)) { - this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccPublic; + this.reportMissingJavadocTagsVisibility = Flags.PUBLIC; } else if (PROTECTED.equals(optionValue)) { - this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccProtected; + this.reportMissingJavadocTagsVisibility = Flags.PROTECTED; } else if (DEFAULT.equals(optionValue)) { - this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccDefault; + this.reportMissingJavadocTagsVisibility = 0; } else if (PRIVATE.equals(optionValue)) { - this.reportMissingJavadocTagsVisibility = ClassFileConstants.AccPrivate; + this.reportMissingJavadocTagsVisibility = Flags.PRIVATE; } } if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsOverriding)) != null) { @@ -2050,13 +2052,13 @@ && getSeverity(ExplicitlyClosedAutoCloseable) == ProblemSeverities.Ignore) { } if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocCommentsVisibility)) != null) { if (PUBLIC.equals(optionValue)) { - this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccPublic; + this.reportMissingJavadocCommentsVisibility = Flags.PUBLIC; } else if (PROTECTED.equals(optionValue)) { - this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccProtected; + this.reportMissingJavadocCommentsVisibility = Flags.PROTECTED; } else if (DEFAULT.equals(optionValue)) { - this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccDefault; + this.reportMissingJavadocCommentsVisibility = 0; } else if (PRIVATE.equals(optionValue)) { - this.reportMissingJavadocCommentsVisibility = ClassFileConstants.AccPrivate; + this.reportMissingJavadocCommentsVisibility = Flags.PRIVATE; } } if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocCommentsOverriding)) != null) { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java index 6b01bf81331..c7de2c21840 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java @@ -40,10 +40,12 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.Constant; +import com.sun.tools.javac.code.Flags; + public final class ArrayBinding extends TypeBinding { // creation and initialization of the length field // the declaringClass of this field is intentionally set to null so it can be distinguished. - public static final FieldBinding ArrayLength = new FieldBinding(TypeConstants.LENGTH, TypeBinding.INT, ClassFileConstants.AccPublic | ClassFileConstants.AccFinal, null, Constant.NotAConstant); + public static final FieldBinding ArrayLength = new FieldBinding(TypeConstants.LENGTH, TypeBinding.INT, Flags.PUBLIC | Flags.FINAL, null, Constant.NotAConstant); public TypeBinding leafComponentType; public int dimensions; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java index 9b52d7d7671..40d5b06e166 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryModuleBinding.java @@ -25,8 +25,8 @@ import org.eclipse.jdt.internal.compiler.env.IModule.IModuleReference; import org.eclipse.jdt.internal.compiler.env.IModule.IPackageExport; import org.eclipse.jdt.internal.compiler.env.IModule.IService; -import org.eclipse.jdt.internal.compiler.util.Util; import org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; +import org.eclipse.jdt.internal.compiler.util.Util; public class BinaryModuleBinding extends ModuleBinding { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java index ede41b0fb93..9c68d174b2f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java @@ -80,6 +80,8 @@ import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + /* Not all fields defined by this type are initialized when it is created. Some are initialized only when needed. @@ -338,7 +340,7 @@ public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, this.tagBits |= TagBits.MemberTypeMask; // must be a member type not a top-level or local type this.tagBits |= TagBits.HasUnresolvedEnclosingType; if (enclosingType().isStrictfp()) - this.modifiers |= ClassFileConstants.AccStrictfp; + this.modifiers |= Flags.STRICTFP; if (enclosingType().isDeprecated()) this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; } @@ -930,11 +932,11 @@ private MethodBinding createMethod(IBinaryMethod method, IBinaryType binaryType, if (!isPrototype()) throw new IllegalStateException(); int methodModifiers = method.getModifiers() | ExtraCompilerModifiers.AccUnresolved; if (sourceLevel < ClassFileConstants.JDK1_5) - methodModifiers &= ~ClassFileConstants.AccVarargs; // vararg methods are not recognized until 1.5 - if (isInterface() && (methodModifiers & ClassFileConstants.AccAbstract) == 0) { + methodModifiers &= ~Flags.ACC_VARARGS; // vararg methods are not recognized until 1.5 + if (isInterface() && (methodModifiers & Flags.ABSTRACT) == 0) { // see https://bugs.eclipse.org/388954 superseded by https://bugs.eclipse.org/390889 - if (((methodModifiers & ClassFileConstants.AccStatic) == 0 - && (methodModifiers & ClassFileConstants.AccPrivate) == 0)) { + if (((methodModifiers & Flags.STATIC) == 0 + && (methodModifiers & Flags.PRIVATE) == 0)) { // i.e. even at 1.7- we record AccDefaultMethod when reading a 1.8+ interface to avoid errors caused by default methods added to a library methodModifiers |= ExtraCompilerModifiers.AccDefaultMethod; } @@ -1190,8 +1192,8 @@ private IBinaryMethod[] createMethods(IBinaryMethod[] iMethods, IBinaryType bina boolean keepBridgeMethods = sourceLevel < ClassFileConstants.JDK1_5; // https://bugs.eclipse.org/bugs/show_bug.cgi?id=330347 for (int i = total; --i >= 0;) { IBinaryMethod method = iMethods[i]; - if ((method.getModifiers() & ClassFileConstants.AccSynthetic) != 0) { - if (keepBridgeMethods && (method.getModifiers() & ClassFileConstants.AccBridge) != 0) + if ((method.getModifiers() & Flags.SYNTHETIC) != 0) { + if (keepBridgeMethods && (method.getModifiers() & Flags.ACC_BRIDGE) != 0) continue; // want to see bridge methods as real methods // discard synthetics methods if (toSkip == null) toSkip = new int[iMethods.length]; @@ -2013,7 +2015,7 @@ SimpleLookupTable storedAnnotations(boolean forceInitialize, boolean forceStore) private void scanFieldForNullAnnotation(IBinaryField field, VariableBinding fieldBinding, boolean isEnum, ITypeAnnotationWalker externalAnnotationWalker) { if (!isPrototype()) throw new IllegalStateException(); - if (isEnum && (field.getModifiers() & ClassFileConstants.AccEnum) != 0) { + if (isEnum && (field.getModifiers() & Flags.ENUM) != 0) { fieldBinding.tagBits |= TagBits.AnnotationNonNull; return; // we know it's nonnull, no need to look for null *annotations* on enum constants. } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java index 45e1260308f..f9683fb2b44 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/BlockScope.java @@ -36,7 +36,15 @@ import java.util.List; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.ast.*; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.CaseStatement; +import org.eclipse.jdt.internal.compiler.ast.FakedTrackingVariable; +import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; +import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ReturnStatement; +import org.eclipse.jdt.internal.compiler.ast.Statement; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.flow.FlowContext; @@ -44,6 +52,8 @@ import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({"rawtypes", "unchecked"}) public class BlockScope extends Scope { @@ -204,7 +214,7 @@ private void checkAndSetModifiersForVariable(LocalVariableBinding varBinding) { } int realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag; - int unexpectedModifiers = ~ClassFileConstants.AccFinal; + int unexpectedModifiers = ~Flags.FINAL; if ((realModifiers & unexpectedModifiers) != 0 && varBinding.declaration != null){ problemReporter().illegalModifierForVariable(varBinding.declaration, this instanceof MethodScope); } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java index e872dea4ba3..2aa2403385a 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CaptureBinding.java @@ -28,6 +28,8 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import com.sun.tools.javac.code.Flags; + public class CaptureBinding extends TypeVariableBinding { public TypeBinding lowerBound; @@ -45,7 +47,7 @@ public class CaptureBinding extends TypeVariableBinding { public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int start, int end, ASTNode cud, int captureID) { super(TypeConstants.WILDCARD_CAPTURE_NAME_PREFIX, wildcard.environment); this.wildcard = wildcard; - this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public + this.modifiers = Flags.PUBLIC | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public this.fPackage = wildcard.fPackage; this.sourceType = sourceType; this.start = start; @@ -76,7 +78,7 @@ public CaptureBinding(WildcardBinding wildcard, ReferenceBinding sourceType, int // for subclass CaptureBinding18 protected CaptureBinding(ReferenceBinding sourceType, char[] sourceName, int start, int end, int captureID, LookupEnvironment environment) { super(sourceName, null, 0, environment); - this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public + this.modifiers = Flags.PUBLIC | ExtraCompilerModifiers.AccGenericSignature; // treat capture as public this.sourceType = sourceType; this.start = start; this.end = end; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java index 40ca193f768..d7b10823674 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java @@ -59,6 +59,8 @@ import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({"rawtypes"}) public class ClassScope extends Scope { @@ -162,7 +164,7 @@ private void checkForEnumSealedPreview(ReferenceBinding supertype, LocalTypeBind sz); permTypes[sz] = anonymousType; } - anonymousType.modifiers |= ClassFileConstants.AccFinal; // JLS 15 / sealed preview/Sec 8.9.1 + anonymousType.modifiers |= Flags.FINAL; // JLS 15 / sealed preview/Sec 8.9.1 sourceSuperType.setPermittedTypes(permTypes); } @@ -594,7 +596,7 @@ private void checkAndSetModifiers() { (modifiers & (ExtraCompilerModifiers.AccSealed | ExtraCompilerModifiers.AccNonSealed)) != 0; if (sourceType.isRecord()) { /* JLS 14 Records Sec 8.10 - A record declaration is implicitly final. */ - modifiers |= ClassFileConstants.AccFinal; + modifiers |= Flags.FINAL; } if ((modifiers & ExtraCompilerModifiers.AccAlternateModifierProblem) != 0) problemReporter().duplicateModifierForType(sourceType); @@ -603,20 +605,20 @@ private void checkAndSetModifiers() { if (isMemberType) { if (sourceType.hasEnclosingInstanceContext()) modifiers |= (enclosingType.modifiers & ExtraCompilerModifiers.AccGenericSignature); - modifiers |= (enclosingType.modifiers & ClassFileConstants.AccStrictfp); + modifiers |= (enclosingType.modifiers & Flags.STRICTFP); // checks for member types before local types to catch local members if (enclosingType.isInterface()) - modifiers |= ClassFileConstants.AccPublic; + modifiers |= Flags.PUBLIC; if (sourceType.isEnum()) { if (!is16Plus && !enclosingType.isStatic()) problemReporter().nonStaticContextForEnumMemberType(sourceType); else - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } else if (sourceType.isInterface()) { - modifiers |= ClassFileConstants.AccStatic; // 8.5.1 + modifiers |= Flags.STATIC; // 8.5.1 } else if (sourceType.isRecord()) { /* JLS 14 Records Sec 8.10 A nested record type is implicitly static */ - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } } else if (sourceType.isLocalType()) { if (sourceType.isEnum()) { @@ -625,36 +627,36 @@ private void checkAndSetModifiers() { sourceType.modifiers = 0; return; } - final int UNEXPECTED_MODIFIERS =~(ClassFileConstants.AccEnum | ClassFileConstants.AccStrictfp); + final int UNEXPECTED_MODIFIERS =~(Flags.ENUM | Flags.STRICTFP); if ((modifiers & ExtraCompilerModifiers.AccJustFlag & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers) { problemReporter().illegalModifierForLocalEnumDeclaration(sourceType); return; } - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } else if (sourceType.isRecord()) { // if (enclosingType != null && enclosingType.isLocalType()) { // problemReporter().illegalLocalTypeDeclaration(this.referenceContext); // return; // } - if ((modifiers & ClassFileConstants.AccStatic) != 0) { + if ((modifiers & Flags.STATIC) != 0) { if (!(this.parent instanceof ClassScope)) problemReporter().recordIllegalStaticModifierForLocalClassOrInterface(sourceType); return; } - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } if (sourceType.isAnonymousType()) { if (compilerOptions().complianceLevel < ClassFileConstants.JDK9) - modifiers |= ClassFileConstants.AccFinal; + modifiers |= Flags.FINAL; // set AccEnum flag for anonymous body of enum constants if (this.referenceContext.allocation.type == null) - modifiers |= ClassFileConstants.AccEnum; + modifiers |= Flags.ENUM; } else if (this.parent.referenceContext() instanceof TypeDeclaration) { TypeDeclaration typeDecl = (TypeDeclaration) this.parent.referenceContext(); if (TypeDeclaration.kind(typeDecl.modifiers) == TypeDeclaration.INTERFACE_DECL) { // Sec 8.1.3 applies for local types as well - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } } Scope scope = this; @@ -674,7 +676,7 @@ private void checkAndSetModifiers() { modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; } else { if (type.isStrictfp()) - modifiers |= ClassFileConstants.AccStrictfp; + modifiers |= Flags.STRICTFP; if (type.isViewedAsDeprecated() && !sourceType.isDeprecated()) modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; } @@ -682,7 +684,7 @@ private void checkAndSetModifiers() { MethodBinding method = ((AbstractMethodDeclaration) methodScope.referenceContext).binding; if (method != null) { if (method.isStrictfp()) - modifiers |= ClassFileConstants.AccStrictfp; + modifiers |= Flags.STRICTFP; if (method.isViewedAsDeprecated() && !sourceType.isDeprecated()) modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; } @@ -691,7 +693,7 @@ private void checkAndSetModifiers() { case CLASS_SCOPE : // local member if (enclosingType.isStrictfp()) - modifiers |= ClassFileConstants.AccStrictfp; + modifiers |= Flags.STRICTFP; if (enclosingType.isViewedAsDeprecated() && !sourceType.isDeprecated()) { modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; sourceType.tagBits |= enclosingType.tagBits & TagBits.AnnotationTerminallyDeprecated; @@ -705,13 +707,13 @@ private void checkAndSetModifiers() { // after this point, tests on the 16 bits reserved. int realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag; - if ((realModifiers & ClassFileConstants.AccInterface) != 0) { // interface and annotation type + if ((realModifiers & Flags.INTERFACE) != 0) { // interface and annotation type // detect abnormal cases for interfaces if (isMemberType) { final int UNEXPECTED_MODIFIERS = - ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected | ClassFileConstants.AccStatic | ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccStrictfp | ClassFileConstants.AccAnnotation); + ~(Flags.PUBLIC | Flags.PRIVATE | Flags.PROTECTED | Flags.STATIC | Flags.ABSTRACT | Flags.INTERFACE | Flags.STRICTFP | Flags.ANNOTATION); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) { - if ((realModifiers & ClassFileConstants.AccAnnotation) != 0) + if ((realModifiers & Flags.ANNOTATION) != 0) problemReporter().illegalModifierForAnnotationMemberType(sourceType); else problemReporter().illegalModifierForMemberInterface(sourceType); @@ -723,20 +725,20 @@ private void checkAndSetModifiers() { problemReporter().illegalModifierForLocalInterface(sourceType); */ } else if (sourceType.isLocalType()) { - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface - | ClassFileConstants.AccStrictfp | ClassFileConstants.AccAnnotation - | ((is16Plus && this.parent instanceof ClassScope) ? ClassFileConstants.AccStatic : 0)); + final int UNEXPECTED_MODIFIERS = ~(Flags.ABSTRACT | Flags.INTERFACE + | Flags.STRICTFP | Flags.ANNOTATION + | ((is16Plus && this.parent instanceof ClassScope) ? Flags.STATIC : 0)); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers) problemReporter().localStaticsIllegalVisibilityModifierForInterfaceLocalType(sourceType); -// if ((modifiers & ClassFileConstants.AccStatic) != 0) { +// if ((modifiers & Flags.STATIC) != 0) { // problemReporter().recordIllegalStaticModifierForLocalClassOrInterface(sourceType); // } - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } else { - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccStrictfp | ClassFileConstants.AccAnnotation); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.ABSTRACT | Flags.INTERFACE | Flags.STRICTFP | Flags.ANNOTATION); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) { - if ((realModifiers & ClassFileConstants.AccAnnotation) != 0) + if ((realModifiers & Flags.ANNOTATION) != 0) problemReporter().illegalModifierForAnnotationType(sourceType); else problemReporter().illegalModifierForInterface(sourceType); @@ -746,17 +748,17 @@ private void checkAndSetModifiers() { * AccSynthetic must be set if the target is greater than 1.5. 1.5 VM don't support AccSynthetics flag. */ if (sourceType.sourceName == TypeConstants.PACKAGE_INFO_NAME && compilerOptions().targetJDK > ClassFileConstants.JDK1_5) { - modifiers |= ClassFileConstants.AccSynthetic; + modifiers |= Flags.SYNTHETIC; } - modifiers |= ClassFileConstants.AccAbstract; - } else if ((realModifiers & ClassFileConstants.AccEnum) != 0) { + modifiers |= Flags.ABSTRACT; + } else if ((realModifiers & Flags.ENUM) != 0) { // detect abnormal cases for enums if (isMemberType) { // includes member types defined inside local types - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected | ClassFileConstants.AccStatic | ClassFileConstants.AccStrictfp | ClassFileConstants.AccEnum); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.PRIVATE | Flags.PROTECTED | Flags.STATIC | Flags.STRICTFP | Flags.ENUM); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers) { problemReporter().illegalModifierForMemberEnum(sourceType); - modifiers &= ~ClassFileConstants.AccAbstract; // avoid leaking abstract modifier - realModifiers &= ~ClassFileConstants.AccAbstract; + modifiers &= ~Flags.ABSTRACT; // avoid leaking abstract modifier + realModifiers &= ~Flags.ABSTRACT; // modifiers &= ~(realModifiers & UNEXPECTED_MODIFIERS); // realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag; } @@ -765,7 +767,7 @@ private void checkAndSetModifiers() { // problemReporter().illegalModifierForLocalEnum(sourceType); // each enum constant is an anonymous local type and its modifiers were already checked as an enum constant field } else { - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccStrictfp | ClassFileConstants.AccEnum); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.STRICTFP | Flags.ENUM); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers) problemReporter().illegalModifierForEnum(sourceType); } @@ -773,7 +775,7 @@ private void checkAndSetModifiers() { checkAbstractEnum: { // does define abstract methods ? if ((this.referenceContext.bits & ASTNode.HasAbstractMethods) != 0) { - modifiers |= ClassFileConstants.AccAbstract; + modifiers |= Flags.ABSTRACT; break checkAbstractEnum; } // body of enum constant must implement any inherited abstract methods @@ -803,7 +805,7 @@ private void checkAndSetModifiers() { // tag this enum as abstract since an abstract method must be implemented AND all enum constants define an anonymous body // as a result, each of its anonymous constants will see it as abstract and must implement each inherited abstract method if (needAbstractBit) { - modifiers |= ClassFileConstants.AccAbstract; + modifiers |= Flags.ABSTRACT; } } // final if no enum constant with anonymous body @@ -820,23 +822,23 @@ private void checkAndSetModifiers() { } } } - modifiers |= ClassFileConstants.AccFinal; + modifiers |= Flags.FINAL; } - if (isSealedSupported && (modifiers & ClassFileConstants.AccFinal) == 0) + if (isSealedSupported && (modifiers & Flags.FINAL) == 0) modifiers |= ExtraCompilerModifiers.AccSealed; } } else if (sourceType.isRecord()) { int UNEXPECTED_MODIFIERS = ExtraCompilerModifiers.AccNonSealed | ExtraCompilerModifiers.AccSealed; if (isMemberType) { - final int EXPECTED_MODIFIERS = (ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp); + final int EXPECTED_MODIFIERS = (Flags.PUBLIC | Flags.PRIVATE | Flags.PROTECTED | Flags.STATIC | Flags.FINAL | Flags.STRICTFP); if ((realModifiers & ~EXPECTED_MODIFIERS) != 0 || (modifiers & UNEXPECTED_MODIFIERS) != 0) problemReporter().illegalModifierForInnerRecord(sourceType); } else if (sourceType.isLocalType()) { - final int EXPECTED_MODIFIERS = (ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp | ClassFileConstants.AccStatic); + final int EXPECTED_MODIFIERS = (Flags.FINAL | Flags.STRICTFP | Flags.STATIC); if ((realModifiers & ~EXPECTED_MODIFIERS) != 0 || (modifiers & UNEXPECTED_MODIFIERS) != 0) problemReporter().illegalModifierForLocalRecord(sourceType); } else { - final int EXPECTED_MODIFIERS = (ClassFileConstants.AccPublic | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp); + final int EXPECTED_MODIFIERS = (Flags.PUBLIC | Flags.FINAL | Flags.STRICTFP); if ((realModifiers & ~EXPECTED_MODIFIERS) != 0 || (modifiers & UNEXPECTED_MODIFIERS) != 0) problemReporter().illegalModifierForRecord(sourceType); } @@ -860,59 +862,59 @@ private void checkAndSetModifiers() { } else { // detect abnormal cases for classes if (isMemberType) { // includes member types defined inside local types - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected | ClassFileConstants.AccStatic | ClassFileConstants.AccAbstract | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.PRIVATE | Flags.PROTECTED | Flags.STATIC | Flags.ABSTRACT | Flags.FINAL | Flags.STRICTFP); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) problemReporter().illegalModifierForMemberClass(sourceType); } else if (sourceType.isLocalType()) { - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp - | ((is16Plus && this.parent instanceof ClassScope) ? ClassFileConstants.AccStatic : 0)); + final int UNEXPECTED_MODIFIERS = ~(Flags.ABSTRACT | Flags.FINAL | Flags.STRICTFP + | ((is16Plus && this.parent instanceof ClassScope) ? Flags.STATIC : 0)); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0 || flagSealedNonModifiers) problemReporter().illegalModifierForLocalClass(sourceType); } else { - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract | ClassFileConstants.AccFinal | ClassFileConstants.AccStrictfp); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.ABSTRACT | Flags.FINAL | Flags.STRICTFP); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) problemReporter().illegalModifierForClass(sourceType); } // check that Final and Abstract are not set together - if ((realModifiers & (ClassFileConstants.AccFinal | ClassFileConstants.AccAbstract)) == (ClassFileConstants.AccFinal | ClassFileConstants.AccAbstract)) + if ((realModifiers & (Flags.FINAL | Flags.ABSTRACT)) == (Flags.FINAL | Flags.ABSTRACT)) problemReporter().illegalModifierCombinationFinalAbstractForClass(sourceType); } if (isMemberType) { // test visibility modifiers inconsistency, isolate the accessors bits if (enclosingType.isInterface()) { - if ((realModifiers & (ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate)) != 0) { + if ((realModifiers & (Flags.PROTECTED | Flags.PRIVATE)) != 0) { problemReporter().illegalVisibilityModifierForInterfaceMemberType(sourceType); // need to keep the less restrictive - if ((realModifiers & ClassFileConstants.AccProtected) != 0) - modifiers &= ~ClassFileConstants.AccProtected; - if ((realModifiers & ClassFileConstants.AccPrivate) != 0) - modifiers &= ~ClassFileConstants.AccPrivate; + if ((realModifiers & Flags.PROTECTED) != 0) + modifiers &= ~Flags.PROTECTED; + if ((realModifiers & Flags.PRIVATE) != 0) + modifiers &= ~Flags.PRIVATE; } } else { - int accessorBits = realModifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate); + int accessorBits = realModifiers & (Flags.PUBLIC | Flags.PROTECTED | Flags.PRIVATE); if ((accessorBits & (accessorBits - 1)) > 1) { problemReporter().illegalVisibilityModifierCombinationForMemberType(sourceType); // need to keep the less restrictive so disable Protected/Private as necessary - if ((accessorBits & ClassFileConstants.AccPublic) != 0) { - if ((accessorBits & ClassFileConstants.AccProtected) != 0) - modifiers &= ~ClassFileConstants.AccProtected; - if ((accessorBits & ClassFileConstants.AccPrivate) != 0) - modifiers &= ~ClassFileConstants.AccPrivate; - } else if ((accessorBits & ClassFileConstants.AccProtected) != 0 && (accessorBits & ClassFileConstants.AccPrivate) != 0) { - modifiers &= ~ClassFileConstants.AccPrivate; + if ((accessorBits & Flags.PUBLIC) != 0) { + if ((accessorBits & Flags.PROTECTED) != 0) + modifiers &= ~Flags.PROTECTED; + if ((accessorBits & Flags.PRIVATE) != 0) + modifiers &= ~Flags.PRIVATE; + } else if ((accessorBits & Flags.PROTECTED) != 0 && (accessorBits & Flags.PRIVATE) != 0) { + modifiers &= ~Flags.PRIVATE; } } } // static modifier test - if ((realModifiers & ClassFileConstants.AccStatic) == 0) { + if ((realModifiers & Flags.STATIC) == 0) { if (enclosingType.isInterface()) - modifiers |= ClassFileConstants.AccStatic; + modifiers |= Flags.STATIC; } else if (!enclosingType.isStatic()) { // if (sourceType.isRecord()) // problemReporter().recordNestedRecordInherentlyStatic(sourceType); @@ -940,13 +942,13 @@ private void checkAndSetModifiersForField(FieldBinding fieldBinding, FieldDeclar problemReporter().duplicateModifierForField(declaringClass, fieldDecl); if (declaringClass.isInterface()) { - final int IMPLICIT_MODIFIERS = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal; + final int IMPLICIT_MODIFIERS = Flags.PUBLIC | Flags.STATIC | Flags.FINAL; // set the modifiers modifiers |= IMPLICIT_MODIFIERS; // and then check that they are the only ones if ((modifiers & ExtraCompilerModifiers.AccJustFlag) != IMPLICIT_MODIFIERS) { - if ((declaringClass.modifiers & ClassFileConstants.AccAnnotation) != 0) + if ((declaringClass.modifiers & Flags.ANNOTATION) != 0) problemReporter().illegalModifierForAnnotationField(fieldDecl); else problemReporter().illegalModifierForInterfaceField(fieldDecl); @@ -963,38 +965,38 @@ private void checkAndSetModifiersForField(FieldBinding fieldBinding, FieldDeclar // as used locally. We are unable to track the usage of these reliably as they could be used // in non obvious ways via the synthesized methods values() and valueOf(String) or by using // Enum.valueOf(Class, String). - final int IMPLICIT_MODIFIERS = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccEnum | ExtraCompilerModifiers.AccLocallyUsed; + final int IMPLICIT_MODIFIERS = Flags.PUBLIC | Flags.STATIC | Flags.FINAL | Flags.ENUM | ExtraCompilerModifiers.AccLocallyUsed; fieldBinding.modifiers|= IMPLICIT_MODIFIERS; return; } // after this point, tests on the 16 bits reserved. int realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag; - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected | ClassFileConstants.AccFinal | ClassFileConstants.AccStatic | ClassFileConstants.AccTransient | ClassFileConstants.AccVolatile); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.PRIVATE | Flags.PROTECTED | Flags.FINAL | Flags.STATIC | Flags.TRANSIENT | Flags.VOLATILE); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) { problemReporter().illegalModifierForField(declaringClass, fieldDecl); modifiers &= ~ExtraCompilerModifiers.AccJustFlag | ~UNEXPECTED_MODIFIERS; } - int accessorBits = realModifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate); + int accessorBits = realModifiers & (Flags.PUBLIC | Flags.PROTECTED | Flags.PRIVATE); if ((accessorBits & (accessorBits - 1)) > 1) { problemReporter().illegalVisibilityModifierCombinationForField(declaringClass, fieldDecl); // need to keep the less restrictive so disable Protected/Private as necessary - if ((accessorBits & ClassFileConstants.AccPublic) != 0) { - if ((accessorBits & ClassFileConstants.AccProtected) != 0) - modifiers &= ~ClassFileConstants.AccProtected; - if ((accessorBits & ClassFileConstants.AccPrivate) != 0) - modifiers &= ~ClassFileConstants.AccPrivate; - } else if ((accessorBits & ClassFileConstants.AccProtected) != 0 && (accessorBits & ClassFileConstants.AccPrivate) != 0) { - modifiers &= ~ClassFileConstants.AccPrivate; + if ((accessorBits & Flags.PUBLIC) != 0) { + if ((accessorBits & Flags.PROTECTED) != 0) + modifiers &= ~Flags.PROTECTED; + if ((accessorBits & Flags.PRIVATE) != 0) + modifiers &= ~Flags.PRIVATE; + } else if ((accessorBits & Flags.PROTECTED) != 0 && (accessorBits & Flags.PRIVATE) != 0) { + modifiers &= ~Flags.PRIVATE; } } - if ((realModifiers & (ClassFileConstants.AccFinal | ClassFileConstants.AccVolatile)) == (ClassFileConstants.AccFinal | ClassFileConstants.AccVolatile)) + if ((realModifiers & (Flags.FINAL | Flags.VOLATILE)) == (Flags.FINAL | Flags.VOLATILE)) problemReporter().illegalModifierCombinationFinalVolatileForField(declaringClass, fieldDecl); - if (fieldDecl.initialization == null && (modifiers & ClassFileConstants.AccFinal) != 0) + if (fieldDecl.initialization == null && (modifiers & Flags.FINAL) != 0) modifiers |= ExtraCompilerModifiers.AccBlankFinal; fieldBinding.modifiers = modifiers; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java index b22ed5e10a3..8ad9c7e8888 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java @@ -29,13 +29,22 @@ import java.util.function.Predicate; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.ast.*; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ImportReference; +import org.eclipse.jdt.internal.compiler.ast.Invocation; +import org.eclipse.jdt.internal.compiler.ast.ModuleDeclaration; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.AccessRestriction; import org.eclipse.jdt.internal.compiler.env.IUpdatableModule; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; -import org.eclipse.jdt.internal.compiler.util.*; +import org.eclipse.jdt.internal.compiler.util.HashtableOfObject; +import org.eclipse.jdt.internal.compiler.util.HashtableOfType; +import org.eclipse.jdt.internal.compiler.util.ObjectVector; + +import com.sun.tools.javac.code.Flags; public class CompilationUnitScope extends Scope { @@ -178,7 +187,7 @@ void buildTypeBindings(AccessRestriction accessRestriction) { continue nextType; } - if ((typeDecl.modifiers & ClassFileConstants.AccPublic) != 0) { + if ((typeDecl.modifiers & Flags.PUBLIC) != 0) { char[] mainTypeName; if ((mainTypeName = this.referenceContext.getMainTypeName()) != null // mainTypeName == null means that implementor of ICompilationUnit decided to return null && !CharOperation.equals(mainTypeName, typeDecl.name)) { @@ -190,7 +199,7 @@ void buildTypeBindings(AccessRestriction accessRestriction) { ClassScope child = new ClassScope(this, typeDecl); SourceTypeBinding type = child.buildType(null, this.fPackage, accessRestriction); if (firstIsSynthetic && i == 0) - type.modifiers |= ClassFileConstants.AccSynthetic; + type.modifiers |= Flags.SYNTHETIC; if (type != null) this.topLevelTypes[count++] = type; } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ElementValuePair.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ElementValuePair.java index 72ddc15e3b3..510286ff3f9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ElementValuePair.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ElementValuePair.java @@ -15,10 +15,17 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; -import org.eclipse.jdt.internal.compiler.ast.*; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.eclipse.jdt.internal.compiler.ast.ArrayInitializer; +import org.eclipse.jdt.internal.compiler.ast.ClassLiteralAccess; +import org.eclipse.jdt.internal.compiler.ast.Expression; +import org.eclipse.jdt.internal.compiler.ast.FieldReference; +import org.eclipse.jdt.internal.compiler.ast.NameReference; +import org.eclipse.jdt.internal.compiler.ast.Reference; import org.eclipse.jdt.internal.compiler.impl.Constant; +import com.sun.tools.javac.code.Flags; + public class ElementValuePair { char[] name; public Object value; @@ -77,7 +84,7 @@ public static Object getValue(Expression expression) { if (binding != null && binding.kind() == Binding.FIELD) fieldBinding = (FieldBinding) binding; } - if (fieldBinding != null && (fieldBinding.modifiers & ClassFileConstants.AccEnum) > 0) + if (fieldBinding != null && (fieldBinding.modifiers & Flags.ENUM) > 0) return fieldBinding; } // something that isn't a compile time constant. diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java index 1c0cb5f2acb..e4e6263b4b7 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ExtraCompilerModifiers.java @@ -19,6 +19,8 @@ import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import com.sun.tools.javac.code.Flags; + // TODO (philippe) these should be moved to tagbits public interface ExtraCompilerModifiers { // modifier constant /** @@ -32,7 +34,7 @@ public interface ExtraCompilerModifiers { // modifier constant final int AccDefaultMethod = ASTNode.Bit17; final int AccCompactConstructor = ASTNode.Bit24; - // bit18 - use by ClassFileConstants.AccAnnotationDefault + // bit18 - use by Flags.ANNOTATIONDefault final int AccRestrictedAccess = ASTNode.Bit19; final int AccFromClassFile = ASTNode.Bit20; final int AccDefaultAbstract = ASTNode.Bit20; @@ -50,7 +52,7 @@ public interface ExtraCompilerModifiers { // modifier constant // generally set when actual usage has been detected // or, (b) when member of a private class is exposed via a non-private subclass // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=328281 - final int AccVisibilityMASK = ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate; + final int AccVisibilityMASK = Flags.PUBLIC | Flags.PROTECTED | Flags.PRIVATE; final int AccSealed = ASTNode.Bit29; // used for class/interface to set sealed final int AccOverriding = ASTNode.Bit29; // record fact a method overrides another one diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java index 540272cc0c1..6eced6a737c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java @@ -32,6 +32,8 @@ import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import com.sun.tools.javac.code.Flags; + public class FieldBinding extends VariableBinding { public ReferenceBinding declaringClass; public int compoundUseFlag = 0; // number or accesses via postIncrement or compoundAssignment @@ -343,13 +345,13 @@ public final boolean isDeprecated() { */ public final boolean isPrivate() { - return (this.modifiers & ClassFileConstants.AccPrivate) != 0; + return (this.modifiers & Flags.PRIVATE) != 0; } /* Answer true if the receiver has private visibility or is enclosed by a class that does. */ public final boolean isOrEnclosedByPrivateType() { - if ((this.modifiers & ClassFileConstants.AccPrivate) != 0) + if ((this.modifiers & Flags.PRIVATE) != 0) return true; return this.declaringClass != null && this.declaringClass.isOrEnclosedByPrivateType(); } @@ -357,31 +359,31 @@ public final boolean isOrEnclosedByPrivateType() { */ public final boolean isProtected() { - return (this.modifiers & ClassFileConstants.AccProtected) != 0; + return (this.modifiers & Flags.PROTECTED) != 0; } /* Answer true if the receiver has public visibility */ public final boolean isPublic() { - return (this.modifiers & ClassFileConstants.AccPublic) != 0; + return (this.modifiers & Flags.PUBLIC) != 0; } /* Answer true if the receiver is a static field */ public final boolean isStatic() { - return (this.modifiers & ClassFileConstants.AccStatic) != 0; + return (this.modifiers & Flags.STATIC) != 0; } /* Answer true if the receiver is not defined in the source of the declaringClass */ public final boolean isSynthetic() { - return (this.modifiers & ClassFileConstants.AccSynthetic) != 0; + return (this.modifiers & Flags.SYNTHETIC) != 0; } /* Answer true if the receiver is a transient field */ public final boolean isTransient() { - return (this.modifiers & ClassFileConstants.AccTransient) != 0; + return (this.modifiers & Flags.TRANSIENT) != 0; } /* Answer true if the receiver's declaring type is deprecated (or any of its enclosing types) */ @@ -406,7 +408,7 @@ public final boolean isViewedAsDeprecated() { @Override public final boolean isVolatile() { - return (this.modifiers & ClassFileConstants.AccVolatile) != 0; + return (this.modifiers & Flags.VOLATILE) != 0; } @Override diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java index 83ddf125533..713ec2017b4 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/IntersectionTypeBinding18.java @@ -27,7 +27,8 @@ import org.eclipse.jdt.core.compiler.InvalidInputException; import org.eclipse.jdt.internal.compiler.ast.Wildcard; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; /** * Abstraction used for intersection casts in Java 8 + and inferred types: @@ -50,7 +51,7 @@ public IntersectionTypeBinding18(ReferenceBinding[] intersectingTypes, LookupEnv this.length = intersectingTypes.length; if (!intersectingTypes[0].isClass()) { this.javaLangObject = environment.getResolvedJavaBaseType(TypeConstants.JAVA_LANG_OBJECT, null); - this.modifiers |= ClassFileConstants.AccInterface; + this.modifiers |= Flags.INTERFACE; } } @@ -59,7 +60,7 @@ private IntersectionTypeBinding18(IntersectionTypeBinding18 prototype) { this.length = prototype.length; if (!this.intersectingTypes[0].isClass()) { this.javaLangObject = prototype.javaLangObject; - this.modifiers |= ClassFileConstants.AccInterface; + this.modifiers |= Flags.INTERFACE; } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java index e40e18e8734..97c80c5bedd 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java @@ -55,7 +55,15 @@ import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.jdt.internal.compiler.ast.Wildcard; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; -import org.eclipse.jdt.internal.compiler.env.*; +import org.eclipse.jdt.internal.compiler.env.AccessRestriction; +import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; +import org.eclipse.jdt.internal.compiler.env.IBinaryType; +import org.eclipse.jdt.internal.compiler.env.IModule; +import org.eclipse.jdt.internal.compiler.env.IModuleAwareNameEnvironment; +import org.eclipse.jdt.internal.compiler.env.INameEnvironment; +import org.eclipse.jdt.internal.compiler.env.INameEnvironmentExtension; +import org.eclipse.jdt.internal.compiler.env.ITypeAnnotationWalker; +import org.eclipse.jdt.internal.compiler.env.NameEnvironmentAnswer; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.impl.ITypeRequestor; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java index 8003ebfd136..4c4c4b1e0f7 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java @@ -53,6 +53,8 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + public class MethodBinding extends Binding { public int modifiers; @@ -91,7 +93,7 @@ public MethodBinding(int modifiers, char[] selector, TypeBinding returnType, Typ if (this.declaringClass != null) { if (this.declaringClass.isStrictfp()) if (!(isNative() || isAbstract())) - this.modifiers |= ClassFileConstants.AccStrictfp; + this.modifiers |= Flags.STRICTFP; } } public MethodBinding(int modifiers, TypeBinding[] parameters, ReferenceBinding[] thrownExceptions, ReferenceBinding declaringClass) { @@ -786,13 +788,13 @@ public boolean hasSubstitutedReturnType() { /* Answer true if the receiver is an abstract method */ public final boolean isAbstract() { - return (this.modifiers & ClassFileConstants.AccAbstract) != 0; + return (this.modifiers & Flags.ABSTRACT) != 0; } /* Answer true if the receiver is a bridge method */ public final boolean isBridge() { - return (this.modifiers & ClassFileConstants.AccBridge) != 0; + return (this.modifiers & Flags.ACC_BRIDGE) != 0; } /* Answer true if the receiver is a constructor @@ -839,7 +841,7 @@ public final boolean isDeprecated() { /* Answer true if the receiver is final and cannot be overridden */ public final boolean isFinal() { - return (this.modifiers & ClassFileConstants.AccFinal) != 0; + return (this.modifiers & Flags.FINAL) != 0; } /* Answer true if the receiver is implementing another method @@ -863,7 +865,7 @@ public final boolean isImplicit() { */ public final boolean isMain() { if (this.selector.length == 4 && CharOperation.equals(this.selector, TypeConstants.MAIN) - && ((this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccStatic)) != 0) + && ((this.modifiers & (Flags.PUBLIC | Flags.STATIC)) != 0) && TypeBinding.VOID == this.returnType && this.parameters.length == 1) { TypeBinding paramType = this.parameters[0]; @@ -877,7 +879,7 @@ public final boolean isMain() { /* Answer true if the receiver is a native method */ public final boolean isNative() { - return (this.modifiers & ClassFileConstants.AccNative) != 0; + return (this.modifiers & Flags.NATIVE) != 0; } /* Answer true if the receiver is overriding another method @@ -889,13 +891,13 @@ public final boolean isOverriding() { /* Answer true if the receiver has private visibility */ public final boolean isPrivate() { - return (this.modifiers & ClassFileConstants.AccPrivate) != 0; + return (this.modifiers & Flags.PRIVATE) != 0; } /* Answer true if the receiver has private visibility or if any of its enclosing types do. */ public final boolean isOrEnclosedByPrivateType() { - if ((this.modifiers & ClassFileConstants.AccPrivate) != 0) + if ((this.modifiers & Flags.PRIVATE) != 0) return true; return this.declaringClass != null && this.declaringClass.isOrEnclosedByPrivateType(); } @@ -903,37 +905,37 @@ public final boolean isOrEnclosedByPrivateType() { /* Answer true if the receiver has protected visibility */ public final boolean isProtected() { - return (this.modifiers & ClassFileConstants.AccProtected) != 0; + return (this.modifiers & Flags.PROTECTED) != 0; } /* Answer true if the receiver has public visibility */ public final boolean isPublic() { - return (this.modifiers & ClassFileConstants.AccPublic) != 0; + return (this.modifiers & Flags.PUBLIC) != 0; } /* Answer true if the receiver is a static method */ public final boolean isStatic() { - return (this.modifiers & ClassFileConstants.AccStatic) != 0; + return (this.modifiers & Flags.STATIC) != 0; } /* Answer true if all float operations must adher to IEEE 754 float/double rules */ public final boolean isStrictfp() { - return (this.modifiers & ClassFileConstants.AccStrictfp) != 0; + return (this.modifiers & Flags.STRICTFP) != 0; } /* Answer true if the receiver is a synchronized method */ public final boolean isSynchronized() { - return (this.modifiers & ClassFileConstants.AccSynchronized) != 0; + return (this.modifiers & Flags.SYNCHRONIZED) != 0; } /* Answer true if the receiver has public visibility */ public final boolean isSynthetic() { - return (this.modifiers & ClassFileConstants.AccSynthetic) != 0; + return (this.modifiers & Flags.SYNTHETIC) != 0; } /* Answer true if the receiver has private visibility and is used locally @@ -945,7 +947,7 @@ public final boolean isUsed() { /* Answer true if the receiver method has varargs */ public boolean isVarargs() { - return (this.modifiers & ClassFileConstants.AccVarargs) != 0; + return (this.modifiers & Flags.ACC_VARARGS) != 0; } public boolean isParameterizedGeneric() { return false; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java index 0db497f065a..3e217aa681c 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java @@ -26,7 +26,19 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ASTVisitor; -import org.eclipse.jdt.internal.compiler.ast.*; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Argument; +import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; +import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; +import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; +import org.eclipse.jdt.internal.compiler.ast.QualifiedNameReference; +import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; +import org.eclipse.jdt.internal.compiler.ast.SingleNameReference; +import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.ast.TypeParameter; +import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.CodeStream; import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; @@ -35,6 +47,8 @@ import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; +import com.sun.tools.javac.code.Flags; + /** * Specific block scope used for methods, constructors or clinits, representing * its outermost blockscope. Note also that such a scope will be provided to enclose @@ -122,13 +136,13 @@ private void checkAndSetModifiersForConstructor(MethodBinding methodBinding) { if ((astNodeBits & ASTNode.IsDefaultConstructor) != 0 ||((astNodeBits & ASTNode.IsImplicit) != 0 && (astNodeBits & ASTNode.IsCanonicalConstructor) != 0)) { // certain flags are propagated from declaring class onto constructor - final int DECLARING_FLAGS = ClassFileConstants.AccEnum|ClassFileConstants.AccPublic|ClassFileConstants.AccProtected; - final int VISIBILITY_FLAGS = ClassFileConstants.AccPrivate|ClassFileConstants.AccPublic|ClassFileConstants.AccProtected; + final int DECLARING_FLAGS = Flags.ENUM|Flags.PUBLIC|Flags.PROTECTED; + final int VISIBILITY_FLAGS = Flags.PRIVATE|Flags.PUBLIC|Flags.PROTECTED; int flags; if ((flags = declaringClass.modifiers & DECLARING_FLAGS) != 0) { - if ((flags & ClassFileConstants.AccEnum) != 0) { + if ((flags & Flags.ENUM) != 0) { modifiers &= ~VISIBILITY_FLAGS; - modifiers |= ClassFileConstants.AccPrivate; // default constructor is implicitly private in enum + modifiers |= Flags.PRIVATE; // default constructor is implicitly private in enum } else { modifiers &= ~VISIBILITY_FLAGS; modifiers |= flags; // propagate public/protected @@ -140,44 +154,44 @@ private void checkAndSetModifiersForConstructor(MethodBinding methodBinding) { int realModifiers = modifiers & ExtraCompilerModifiers.AccJustFlag; // check for abnormal modifiers - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected | ClassFileConstants.AccStrictfp); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.PRIVATE | Flags.PROTECTED | Flags.STRICTFP); if (declaringClass.isEnum() && (((ConstructorDeclaration) this.referenceContext).bits & ASTNode.IsDefaultConstructor) == 0) { - final int UNEXPECTED_ENUM_CONSTR_MODIFIERS = ~(ClassFileConstants.AccPrivate | ClassFileConstants.AccStrictfp); + final int UNEXPECTED_ENUM_CONSTR_MODIFIERS = ~(Flags.PRIVATE | Flags.STRICTFP); if ((realModifiers & UNEXPECTED_ENUM_CONSTR_MODIFIERS) != 0) { problemReporter().illegalModifierForEnumConstructor((AbstractMethodDeclaration) this.referenceContext); modifiers &= ~ExtraCompilerModifiers.AccJustFlag | ~UNEXPECTED_ENUM_CONSTR_MODIFIERS; - } else if ((((AbstractMethodDeclaration) this.referenceContext).modifiers & ClassFileConstants.AccStrictfp) != 0) { + } else if ((((AbstractMethodDeclaration) this.referenceContext).modifiers & Flags.STRICTFP) != 0) { // must check the parse node explicitly problemReporter().illegalModifierForMethod((AbstractMethodDeclaration) this.referenceContext); } - modifiers |= ClassFileConstants.AccPrivate; // enum constructor is implicitly private + modifiers |= Flags.PRIVATE; // enum constructor is implicitly private } else if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) { problemReporter().illegalModifierForMethod((AbstractMethodDeclaration) this.referenceContext); modifiers &= ~ExtraCompilerModifiers.AccJustFlag | ~UNEXPECTED_MODIFIERS; - } else if ((((AbstractMethodDeclaration) this.referenceContext).modifiers & ClassFileConstants.AccStrictfp) != 0) { + } else if ((((AbstractMethodDeclaration) this.referenceContext).modifiers & Flags.STRICTFP) != 0) { // must check the parse node explicitly problemReporter().illegalModifierForMethod((AbstractMethodDeclaration) this.referenceContext); } // check for incompatible modifiers in the visibility bits, isolate the visibility bits - int accessorBits = realModifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate); + int accessorBits = realModifiers & (Flags.PUBLIC | Flags.PROTECTED | Flags.PRIVATE); if ((accessorBits & (accessorBits - 1)) != 0) { problemReporter().illegalVisibilityModifierCombinationForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext); // need to keep the less restrictive so disable Protected/Private as necessary - if ((accessorBits & ClassFileConstants.AccPublic) != 0) { - if ((accessorBits & ClassFileConstants.AccProtected) != 0) - modifiers &= ~ClassFileConstants.AccProtected; - if ((accessorBits & ClassFileConstants.AccPrivate) != 0) - modifiers &= ~ClassFileConstants.AccPrivate; - } else if ((accessorBits & ClassFileConstants.AccProtected) != 0 && (accessorBits & ClassFileConstants.AccPrivate) != 0) { - modifiers &= ~ClassFileConstants.AccPrivate; + if ((accessorBits & Flags.PUBLIC) != 0) { + if ((accessorBits & Flags.PROTECTED) != 0) + modifiers &= ~Flags.PROTECTED; + if ((accessorBits & Flags.PRIVATE) != 0) + modifiers &= ~Flags.PRIVATE; + } else if ((accessorBits & Flags.PROTECTED) != 0 && (accessorBits & Flags.PRIVATE) != 0) { + modifiers &= ~Flags.PRIVATE; } } // // if the receiver's declaring class is a private nested type, then make sure the receiver is not private (causes problems for inner type emulation) -// if (declaringClass.isPrivate() && (modifiers & ClassFileConstants.AccPrivate) != 0) -// modifiers &= ~ClassFileConstants.AccPrivate; +// if (declaringClass.isPrivate() && (modifiers & Flags.PRIVATE) != 0) +// modifiers &= ~Flags.PRIVATE; methodBinding.modifiers = modifiers; } @@ -197,13 +211,13 @@ private void checkAndSetModifiersForMethod(MethodBinding methodBinding) { long sourceLevel = compilerOptions().sourceLevel; // set the requested modifiers for a method in an interface/annotation if (declaringClass.isInterface()) { - int expectedModifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract; + int expectedModifiers = Flags.PUBLIC | Flags.ABSTRACT; boolean isDefaultMethod = (modifiers & ExtraCompilerModifiers.AccDefaultMethod) != 0; // no need to check validity, is done by the parser boolean reportIllegalModifierCombination = false; if (sourceLevel >= ClassFileConstants.JDK1_8 && !declaringClass.isAnnotationType()) { - expectedModifiers |= ClassFileConstants.AccStrictfp - | ExtraCompilerModifiers.AccDefaultMethod | ClassFileConstants.AccStatic; - expectedModifiers |= sourceLevel >= ClassFileConstants.JDK9 ? ClassFileConstants.AccPrivate : 0; + expectedModifiers |= Flags.STRICTFP + | ExtraCompilerModifiers.AccDefaultMethod | Flags.STATIC; + expectedModifiers |= sourceLevel >= ClassFileConstants.JDK9 ? Flags.PRIVATE : 0; if (!methodBinding.isAbstract()) { reportIllegalModifierCombination = isDefaultMethod && methodBinding.isStatic(); } else { @@ -215,10 +229,10 @@ private void checkAndSetModifiersForMethod(MethodBinding methodBinding) { if (reportIllegalModifierCombination) { problemReporter().illegalModifierCombinationForInterfaceMethod((AbstractMethodDeclaration) this.referenceContext); } - if (sourceLevel >= ClassFileConstants.JDK9 && (methodBinding.modifiers & ClassFileConstants.AccPrivate) != 0) { + if (sourceLevel >= ClassFileConstants.JDK9 && (methodBinding.modifiers & Flags.PRIVATE) != 0) { int remaining = realModifiers & ~expectedModifiers; if (remaining == 0) { // check for the combination of allowed modifiers with private - remaining = realModifiers & ~(ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccStrictfp); + remaining = realModifiers & ~(Flags.PRIVATE | Flags.STATIC | Flags.STRICTFP); if (isDefaultMethod || remaining != 0) problemReporter().illegalModifierCombinationForPrivateInterfaceMethod((AbstractMethodDeclaration) this.referenceContext); } @@ -229,7 +243,7 @@ private void checkAndSetModifiersForMethod(MethodBinding methodBinding) { } } if ((realModifiers & ~expectedModifiers) != 0) { - if ((declaringClass.modifiers & ClassFileConstants.AccAnnotation) != 0) + if ((declaringClass.modifiers & Flags.ANNOTATION) != 0) problemReporter().illegalModifierForAnnotationMember((AbstractMethodDeclaration) this.referenceContext); else problemReporter().illegalModifierForInterfaceMethod((AbstractMethodDeclaration) this.referenceContext, sourceLevel); @@ -244,39 +258,39 @@ private void checkAndSetModifiersForMethod(MethodBinding methodBinding) { TypeReference ref = local.scope.referenceContext.allocation.type; if (ref != null && (ref.bits & ASTNode.IsDiamond) != 0) { // - if ((realModifiers & (ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic )) == 0) { + if ((realModifiers & (Flags.PRIVATE | Flags.STATIC )) == 0) { methodBinding.tagBits |= TagBits.AnnotationOverride; } } } // check for abnormal modifiers - final int UNEXPECTED_MODIFIERS = ~(ClassFileConstants.AccPublic | ClassFileConstants.AccPrivate | ClassFileConstants.AccProtected - | ClassFileConstants.AccAbstract | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp); + final int UNEXPECTED_MODIFIERS = ~(Flags.PUBLIC | Flags.PRIVATE | Flags.PROTECTED + | Flags.ABSTRACT | Flags.STATIC | Flags.FINAL | Flags.SYNCHRONIZED | Flags.NATIVE | Flags.STRICTFP); if ((realModifiers & UNEXPECTED_MODIFIERS) != 0) { problemReporter().illegalModifierForMethod((AbstractMethodDeclaration) this.referenceContext); modifiers &= ~ExtraCompilerModifiers.AccJustFlag | ~UNEXPECTED_MODIFIERS; } // check for incompatible modifiers in the visibility bits, isolate the visibility bits - int accessorBits = realModifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate); + int accessorBits = realModifiers & (Flags.PUBLIC | Flags.PROTECTED | Flags.PRIVATE); if ((accessorBits & (accessorBits - 1)) != 0) { problemReporter().illegalVisibilityModifierCombinationForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext); // need to keep the less restrictive so disable Protected/Private as necessary - if ((accessorBits & ClassFileConstants.AccPublic) != 0) { - if ((accessorBits & ClassFileConstants.AccProtected) != 0) - modifiers &= ~ClassFileConstants.AccProtected; - if ((accessorBits & ClassFileConstants.AccPrivate) != 0) - modifiers &= ~ClassFileConstants.AccPrivate; - } else if ((accessorBits & ClassFileConstants.AccProtected) != 0 && (accessorBits & ClassFileConstants.AccPrivate) != 0) { - modifiers &= ~ClassFileConstants.AccPrivate; + if ((accessorBits & Flags.PUBLIC) != 0) { + if ((accessorBits & Flags.PROTECTED) != 0) + modifiers &= ~Flags.PROTECTED; + if ((accessorBits & Flags.PRIVATE) != 0) + modifiers &= ~Flags.PRIVATE; + } else if ((accessorBits & Flags.PROTECTED) != 0 && (accessorBits & Flags.PRIVATE) != 0) { + modifiers &= ~Flags.PRIVATE; } } // check for modifiers incompatible with abstract modifier - if ((modifiers & ClassFileConstants.AccAbstract) != 0) { - int incompatibleWithAbstract = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccFinal | ClassFileConstants.AccSynchronized | ClassFileConstants.AccNative | ClassFileConstants.AccStrictfp; + if ((modifiers & Flags.ABSTRACT) != 0) { + int incompatibleWithAbstract = Flags.PRIVATE | Flags.STATIC | Flags.FINAL | Flags.SYNCHRONIZED | Flags.NATIVE | Flags.STRICTFP; if ((modifiers & incompatibleWithAbstract) != 0) problemReporter().illegalAbstractModifierCombinationForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext); if (!methodBinding.declaringClass.isAbstract()) @@ -289,12 +303,12 @@ private void checkAndSetModifiersForMethod(MethodBinding methodBinding) { modifiers |= AccFinal; */ // native methods cannot also be tagged as strictfp - if ((modifiers & ClassFileConstants.AccNative) != 0 && (modifiers & ClassFileConstants.AccStrictfp) != 0) + if ((modifiers & Flags.NATIVE) != 0 && (modifiers & Flags.STRICTFP) != 0) problemReporter().nativeMethodsCannotBeStrictfp(declaringClass, (AbstractMethodDeclaration) this.referenceContext); // static members are only authorized in a static member or top level type if (sourceLevel < ClassFileConstants.JDK16) { - if (((realModifiers & ClassFileConstants.AccStatic) != 0) && declaringClass.isNestedType() && !declaringClass.isStatic()) + if (((realModifiers & Flags.STATIC) != 0) && declaringClass.isNestedType() && !declaringClass.isStatic()) problemReporter().unexpectedStaticModifierForMethod(declaringClass, (AbstractMethodDeclaration) this.referenceContext); } @@ -394,12 +408,12 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { checkAndSetModifiersForConstructor(method.binding); } else { if (declaringClass.isInterface()) {// interface or annotation type - if (sourceLevel >= ClassFileConstants.JDK9 && ((method.modifiers & ClassFileConstants.AccPrivate) != 0)) { // private method + if (sourceLevel >= ClassFileConstants.JDK9 && ((method.modifiers & Flags.PRIVATE) != 0)) { // private method // do nothing } else if (method.isDefaultMethod() || method.isStatic()) { - modifiers |= ClassFileConstants.AccPublic; // default method is not abstract + modifiers |= Flags.PUBLIC; // default method is not abstract } else { - modifiers |= ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract; + modifiers |= Flags.PUBLIC | Flags.ABSTRACT; } } method.binding = @@ -415,7 +429,7 @@ MethodBinding createMethod(AbstractMethodDeclaration method) { method.binding.parameterNames = new char[argLength][]; method.binding.parameterNames[--argLength] = argument.name; if (argument.isVarArgs() && sourceLevel >= ClassFileConstants.JDK1_5) - method.binding.modifiers |= ClassFileConstants.AccVarargs; + method.binding.modifiers |= Flags.ACC_VARARGS; if (CharOperation.equals(argument.name, ConstantPool.This)) { problemReporter().illegalThisDeclaration(argument); } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java index f0b899c4f03..8e97285a0f3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java @@ -30,7 +30,9 @@ import java.util.List; import java.util.Set; -import org.eclipse.jdt.internal.compiler.ast.*; +import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java index 54483434412..e1ac310ccf1 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java @@ -17,7 +17,8 @@ import java.util.List; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; public class MissingTypeBinding extends BinaryTypeBinding { @@ -35,7 +36,7 @@ public MissingTypeBinding(PackageBinding packageBinding, char[][] compoundName, this.fPackage = packageBinding; this.fileName = CharOperation.concatWith(compoundName, '/'); this.sourceName = compoundName[compoundName.length - 1]; // [java][util][Map$Entry] - this.modifiers = ClassFileConstants.AccPublic; + this.modifiers = Flags.PUBLIC; this.superclass = null; // will be fixed up using #setMissingSuperclass(...) this.superInterfaces = Binding.NO_SUPERINTERFACES; this.permittedSubtypes = Binding.NO_PERMITTEDTYPES; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java index e401c55760e..257ca0496b7 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ParameterizedFieldBinding.java @@ -13,9 +13,10 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; +import com.sun.tools.javac.code.Flags; + /** * Binding denoting a field after type substitution got performed. * On parameterized type bindings, all fields got substituted, regardless whether @@ -29,9 +30,9 @@ public class ParameterizedFieldBinding extends FieldBinding { public ParameterizedFieldBinding(ParameterizedTypeBinding parameterizedDeclaringClass, FieldBinding originalField) { super ( originalField.name, - (originalField.modifiers & ClassFileConstants.AccEnum) != 0 + (originalField.modifiers & Flags.ENUM) != 0 ? parameterizedDeclaringClass // enum constant get paramType as its type - : (originalField.modifiers & ClassFileConstants.AccStatic) != 0 + : (originalField.modifiers & Flags.STATIC) != 0 ? originalField.type // no subst for static field : Scope.substitute(parameterizedDeclaringClass, originalField.type), originalField.modifiers, diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/RecordComponentBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/RecordComponentBinding.java index e2494326133..e83be5986a6 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/RecordComponentBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/RecordComponentBinding.java @@ -19,6 +19,8 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import com.sun.tools.javac.code.Flags; + public class RecordComponentBinding extends VariableBinding { public ReferenceBinding declaringRecord; @@ -103,7 +105,7 @@ public final boolean isDeprecated() { // TODO: check public final boolean isPublic() { - return (this.modifiers & ClassFileConstants.AccPublic) != 0; + return (this.modifiers & Flags.PUBLIC) != 0; } /** * Returns the original RecordComponent (as opposed to parameterized instances) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java index 6053dc0c4dd..035695dd549 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java @@ -66,6 +66,8 @@ import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; +import com.sun.tools.javac.code.Flags; + /* Not all fields defined by this type (& its subclasses) are initialized when it is created. Some are initialized only when needed. @@ -305,7 +307,7 @@ protected boolean isFieldInitializationFinished() { */ @Override public boolean canBeInstantiated() { - return (this.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) == 0; + return (this.modifiers & (Flags.ABSTRACT | Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) == 0; } /** @@ -1061,7 +1063,7 @@ public int enumConstantCount() { int count = 0; FieldBinding[] fields = fields(); for (int i = 0, length = fields.length; i < length; i++) { - if ((fields[i].modifiers & ClassFileConstants.AccEnum) != 0) count++; + if ((fields[i].modifiers & Flags.ENUM) != 0) count++; } return count; } @@ -1389,12 +1391,12 @@ boolean implementsMethod(MethodBinding method) { * Answer true if the receiver is an abstract type */ public final boolean isAbstract() { - return (this.modifiers & ClassFileConstants.AccAbstract) != 0; + return (this.modifiers & Flags.ABSTRACT) != 0; } @Override public boolean isAnnotationType() { - return (this.modifiers & ClassFileConstants.AccAnnotation) != 0; + return (this.modifiers & Flags.ANNOTATION) != 0; } public final boolean isBinaryBinding() { @@ -1403,7 +1405,7 @@ public final boolean isBinaryBinding() { @Override public boolean isClass() { - return (this.modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation | ClassFileConstants.AccEnum)) == 0; + return (this.modifiers & (Flags.INTERFACE | Flags.ANNOTATION | Flags.ENUM)) == 0; } private static SourceTypeBinding getSourceTypeBinding(ReferenceBinding ref) { @@ -1617,7 +1619,7 @@ protected boolean isSubTypeOfRTL(TypeBinding other) { * Answer true if the receiver has default visibility */ public final boolean isDefault() { - return (this.modifiers & (ClassFileConstants.AccPublic | ClassFileConstants.AccProtected | ClassFileConstants.AccPrivate)) == 0; + return (this.modifiers & (Flags.PUBLIC | Flags.PROTECTED | Flags.PRIVATE)) == 0; } /** @@ -1629,14 +1631,14 @@ public final boolean isDeprecated() { @Override public boolean isEnum() { - return (this.modifiers & ClassFileConstants.AccEnum) != 0; + return (this.modifiers & Flags.ENUM) != 0; } /** * Answer true if the receiver is final and cannot be subclassed */ public final boolean isFinal() { - return (this.modifiers & ClassFileConstants.AccFinal) != 0; + return (this.modifiers & Flags.FINAL) != 0; } /** @@ -1663,7 +1665,7 @@ public boolean isHierarchyConnected() { @Override public boolean isInterface() { // consider strict interfaces and annotation types - return (this.modifiers & ClassFileConstants.AccInterface) != 0; + return (this.modifiers & Flags.INTERFACE) != 0; } @Override @@ -1676,7 +1678,7 @@ public boolean isFunctionalInterface(Scope scope) { * Answer true if the receiver has private visibility */ public final boolean isPrivate() { - return (this.modifiers & ClassFileConstants.AccPrivate) != 0; + return (this.modifiers & Flags.PRIVATE) != 0; } /** @@ -1686,7 +1688,7 @@ public final boolean isOrEnclosedByPrivateType() { if (isLocalType()) return true; // catch all local types ReferenceBinding type = this; while (type != null) { - if ((type.modifiers & ClassFileConstants.AccPrivate) != 0) + if ((type.modifiers & Flags.PRIVATE) != 0) return true; type = type.enclosingType(); } @@ -1697,14 +1699,14 @@ public final boolean isOrEnclosedByPrivateType() { * Answer true if the receiver has protected visibility */ public final boolean isProtected() { - return (this.modifiers & ClassFileConstants.AccProtected) != 0; + return (this.modifiers & Flags.PROTECTED) != 0; } /** * Answer true if the receiver has public visibility */ public final boolean isPublic() { - return (this.modifiers & ClassFileConstants.AccPublic) != 0; + return (this.modifiers & Flags.PUBLIC) != 0; } /** @@ -1712,14 +1714,14 @@ public final boolean isPublic() { */ @Override public final boolean isStatic() { - return (this.modifiers & (ClassFileConstants.AccStatic | ClassFileConstants.AccInterface)) != 0 || (this.tagBits & TagBits.IsNestedType) == 0; + return (this.modifiers & (Flags.STATIC | Flags.INTERFACE)) != 0 || (this.tagBits & TagBits.IsNestedType) == 0; } /** * Answer true if all float operations must adher to IEEE 754 float/double rules */ public final boolean isStrictfp() { - return (this.modifiers & ClassFileConstants.AccStrictfp) != 0; + return (this.modifiers & Flags.STRICTFP) != 0; } /** @@ -2441,7 +2443,7 @@ public MethodBinding getSingleAbstractMethod(Scope scope, boolean replaceWildcar if (exceptionsCount != exceptionsLength) { System.arraycopy(exceptions, 0, exceptions = new ReferenceBinding[exceptionsCount], 0, exceptionsCount); } - this.singleAbstractMethod[index] = new MethodBinding(theAbstractMethod.modifiers | ClassFileConstants.AccSynthetic, + this.singleAbstractMethod[index] = new MethodBinding(theAbstractMethod.modifiers | Flags.SYNTHETIC, theAbstractMethod.selector, returnType, parameters, diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java index 6abf52707b9..dc9aeac1e54 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/Scope.java @@ -64,12 +64,37 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.function.Supplier; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.ast.*; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Annotation; +import org.eclipse.jdt.internal.compiler.ast.CaseStatement; +import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; +import org.eclipse.jdt.internal.compiler.ast.Expression; +import org.eclipse.jdt.internal.compiler.ast.ExpressionContext; +import org.eclipse.jdt.internal.compiler.ast.ImportReference; +import org.eclipse.jdt.internal.compiler.ast.Invocation; +import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; +import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration; +import org.eclipse.jdt.internal.compiler.ast.ModuleDeclaration; +import org.eclipse.jdt.internal.compiler.ast.NameReference; +import org.eclipse.jdt.internal.compiler.ast.ReferenceExpression; +import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; +import org.eclipse.jdt.internal.compiler.ast.TypeParameter; +import org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.eclipse.jdt.internal.compiler.ast.Wildcard; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.codegen.ConstantPool; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; @@ -81,6 +106,8 @@ import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; import org.eclipse.jdt.internal.compiler.util.SimpleSet; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({ "rawtypes", "unchecked" }) public abstract class Scope { @@ -2413,7 +2440,7 @@ public MethodBinding getExactConstructor(TypeBinding receiverType, InvocationSit TypeBinding leafType = receiverType.leafComponentType(); if (!leafType.canBeSeenBy(this) || !leafType.isReifiable()) return null; - return new MethodBinding(ClassFileConstants.AccPublic | ClassFileConstants.AccSynthetic, TypeConstants.INIT, + return new MethodBinding(Flags.PUBLIC | Flags.SYNTHETIC, TypeConstants.INIT, receiverType, new TypeBinding[] { TypeBinding.INT }, Binding.NO_EXCEPTIONS, diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java index 7eff445d340..eec29fa8780 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java @@ -60,8 +60,8 @@ import java.util.Arrays; import java.util.Collection; import java.util.Comparator; -import java.util.LinkedHashMap; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -96,6 +96,7 @@ import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; @SuppressWarnings({ "rawtypes", "unchecked" }) @@ -222,7 +223,7 @@ private void addDefaultAbstractMethods() { } } MethodBinding defaultAbstract = new MethodBinding( - method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | ClassFileConstants.AccSynthetic, + method.modifiers | ExtraCompilerModifiers.AccDefaultAbstract | Flags.SYNTHETIC, method.selector, method.returnType, method.parameters, @@ -276,7 +277,7 @@ public FieldBinding addSyntheticFieldForInnerclass(LocalVariableBinding actualOu synthField = new SyntheticFieldBinding( CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name), actualOuterLocalVariable.type, - ClassFileConstants.AccPrivate | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic, + Flags.PRIVATE | Flags.FINAL | Flags.SYNTHETIC, this, Constant.NotAConstant, this.synthetics[SourceTypeBinding.FIELD_EMUL].size()); @@ -327,7 +328,7 @@ public FieldBinding addSyntheticFieldForInnerclass(ReferenceBinding enclosingTyp TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, String.valueOf(enclosingType.depth()).toCharArray()), enclosingType, - ClassFileConstants.AccDefault | ClassFileConstants.AccFinal | ClassFileConstants.AccSynthetic, + 0 | Flags.FINAL | Flags.SYNTHETIC, this, Constant.NotAConstant, this.synthetics[SourceTypeBinding.FIELD_EMUL].size()); @@ -380,7 +381,7 @@ public FieldBinding addSyntheticFieldForClassLiteral(TypeBinding targetType, Blo TypeConstants.SYNTHETIC_CLASS, String.valueOf(this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size()).toCharArray()), blockScope.getJavaLangClass(), - ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic, + 0 | Flags.STATIC | Flags.SYNTHETIC, this, Constant.NotAConstant, this.synthetics[SourceTypeBinding.CLASS_LITERAL_EMUL].size()); @@ -419,7 +420,7 @@ public FieldBinding addSyntheticFieldForAssert(BlockScope blockScope) { synthField = new SyntheticFieldBinding( TypeConstants.SYNTHETIC_ASSERT_DISABLED, TypeBinding.BOOLEAN, - (isInterface() ? ClassFileConstants.AccPublic : ClassFileConstants.AccDefault) | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal, + (isInterface() ? Flags.PUBLIC : 0) | Flags.STATIC | Flags.SYNTHETIC | Flags.FINAL, this, Constant.NotAConstant, this.synthetics[SourceTypeBinding.FIELD_EMUL].size()); @@ -465,7 +466,7 @@ public FieldBinding addSyntheticFieldForEnumValues() { synthField = new SyntheticFieldBinding( TypeConstants.SYNTHETIC_ENUM_VALUES, this.scope.createArrayType(this,1), - ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic | ClassFileConstants.AccFinal, + Flags.PRIVATE | Flags.STATIC | Flags.SYNTHETIC | Flags.FINAL, this, Constant.NotAConstant, this.synthetics[SourceTypeBinding.FIELD_EMUL].size()); @@ -559,7 +560,7 @@ public SyntheticFieldBinding addSyntheticFieldForSwitchEnum(char[] fieldName, St synthField = new SyntheticFieldBinding( fieldName, this.scope.createArrayType(TypeBinding.INT,1), - (isInterface() ? (ClassFileConstants.AccPublic | ClassFileConstants.AccFinal) : ClassFileConstants.AccPrivate | ClassFileConstants.AccVolatile) | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic, + (isInterface() ? (Flags.PUBLIC | Flags.FINAL) : Flags.PRIVATE | Flags.VOLATILE) | Flags.STATIC | Flags.SYNTHETIC, this, Constant.NotAConstant, this.synthetics[SourceTypeBinding.FIELD_EMUL].size()); @@ -1431,7 +1432,7 @@ public RecordComponentBinding[] components() { smb.parameters[i] = this.components[i].type; } if (this.isVarArgs == true) { - smb.modifiers |= ClassFileConstants.AccVarargs; + smb.modifiers |= Flags.ACC_VARARGS; } } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java index 2f6b42eb95f..c7517b8c349 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticArgumentBinding.java @@ -25,7 +25,8 @@ */ import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; public class SyntheticArgumentBinding extends LocalVariableBinding { @@ -44,7 +45,7 @@ public SyntheticArgumentBinding(LocalVariableBinding actualOuterLocalVariable) { super( CharOperation.concat(TypeConstants.SYNTHETIC_OUTER_LOCAL_PREFIX, actualOuterLocalVariable.name), actualOuterLocalVariable.type, - ClassFileConstants.AccFinal, + Flags.FINAL, true); this.actualOuterLocalVariable = actualOuterLocalVariable; } @@ -56,7 +57,7 @@ public SyntheticArgumentBinding(ReferenceBinding enclosingType) { TypeConstants.SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, String.valueOf(enclosingType.depth()).toCharArray()), enclosingType, - ClassFileConstants.AccFinal, + Flags.FINAL, true); } } diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java index de075b8fc4c..37f36d8fb18 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticFactoryMethodBinding.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jdt.internal.compiler.lookup; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import com.sun.tools.javac.code.Flags; /** * Encodes a synthetic <factory> method used for resolving a diamond constructor. @@ -25,7 +25,7 @@ public class SyntheticFactoryMethodBinding extends MethodBinding { private ReferenceBinding enclosingType; public SyntheticFactoryMethodBinding(MethodBinding method, LookupEnvironment environment, ReferenceBinding enclosingType) { - super(method.modifiers | ClassFileConstants.AccStatic, TypeConstants.SYNTHETIC_STATIC_FACTORY, + super(method.modifiers | Flags.STATIC, TypeConstants.SYNTHETIC_STATIC_FACTORY, null, null, null, method.declaringClass); this.environment = environment; this.staticFactoryFor = method; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java index 5f582e80627..58415a1b15d 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java @@ -27,7 +27,8 @@ import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; import org.eclipse.jdt.internal.compiler.ast.ReferenceExpression; import org.eclipse.jdt.internal.compiler.ast.SwitchStatement; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; public class SyntheticMethodBinding extends MethodBinding { @@ -83,7 +84,7 @@ public class SyntheticMethodBinding extends MethodBinding { public int fakePaddedParameters = 0; // added in synthetic constructor to avoid name clash. public SyntheticMethodBinding(FieldBinding targetField, boolean isReadAccess, boolean isSuperAccess, ReferenceBinding declaringClass) { - this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; + this.modifiers = Flags.STATIC | Flags.SYNTHETIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass; SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods(); @@ -186,7 +187,7 @@ public static void main(String args[]) { } public SyntheticMethodBinding(FieldBinding targetField, ReferenceBinding declaringClass, TypeBinding enumBinding, char[] selector, SwitchStatement switchStatement) { - this.modifiers = (declaringClass.isInterface() ? ClassFileConstants.AccPublic : ClassFileConstants.AccDefault) | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; + this.modifiers = (declaringClass.isInterface() ? Flags.PUBLIC : 0) | Flags.STATIC | Flags.SYNTHETIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass; SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods(); @@ -202,7 +203,7 @@ public SyntheticMethodBinding(FieldBinding targetField, ReferenceBinding declari this.declaringClass = declaringSourceType; this.switchStatement = switchStatement; if (declaringSourceType.isStrictfp()) { - this.modifiers |= ClassFileConstants.AccStrictfp; + this.modifiers |= Flags.STRICTFP; } // check for method collision boolean needRename; @@ -267,7 +268,7 @@ public SyntheticMethodBinding(MethodBinding overridenMethodToBridge, MethodBindi this.selector = overridenMethodToBridge.selector; // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794) // also use the modifiers from the target method, as opposed to inherited one (147690) - this.modifiers = (targetMethod.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccSynchronized | ClassFileConstants.AccAbstract | ClassFileConstants.AccNative | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature); + this.modifiers = (targetMethod.modifiers | Flags.ACC_BRIDGE| Flags.SYNTHETIC) & ~(Flags.SYNCHRONIZED | Flags.ABSTRACT | Flags.NATIVE | Flags.FINAL | ExtraCompilerModifiers.AccGenericSignature); this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.returnType = overridenMethodToBridge.returnType; this.parameters = overridenMethodToBridge.parameters; @@ -283,7 +284,7 @@ public SyntheticMethodBinding(MethodBinding overridenMethodToBridge, MethodBindi public SyntheticMethodBinding(SourceTypeBinding declaringEnum, char[] selector) { this.declaringClass = declaringEnum; this.selector = selector; - this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic; + this.modifiers = Flags.PUBLIC | Flags.STATIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); LookupEnvironment environment = declaringEnum.scope.environment(); this.thrownExceptions = Binding.NO_EXCEPTIONS; @@ -298,7 +299,7 @@ public SyntheticMethodBinding(SourceTypeBinding declaringEnum, char[] selector) } this.index = nextSmbIndex(); if (declaringEnum.isStrictfp()) { - this.modifiers |= ClassFileConstants.AccStrictfp; + this.modifiers |= Flags.STRICTFP; } } @@ -314,7 +315,7 @@ private int nextSmbIndex() { public SyntheticMethodBinding(SourceTypeBinding declaringClass) { this.declaringClass = declaringClass; this.selector = TypeConstants.DESERIALIZE_LAMBDA; - this.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; + this.modifiers = Flags.PRIVATE | Flags.STATIC | Flags.SYNTHETIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.thrownExceptions = Binding.NO_EXCEPTIONS; this.returnType = declaringClass.scope.getJavaLangObject(); @@ -332,7 +333,7 @@ public SyntheticMethodBinding(SourceTypeBinding declaringEnum, int startIndex, i StringBuffer buffer = new StringBuffer(); buffer.append(TypeConstants.SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX).append(this.index); this.selector = String.valueOf(buffer).toCharArray(); - this.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic; + this.modifiers = Flags.PRIVATE | Flags.STATIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.purpose = SyntheticMethodBinding.TooManyEnumsConstants; this.thrownExceptions = Binding.NO_EXCEPTIONS; @@ -352,7 +353,7 @@ public SyntheticMethodBinding(MethodBinding overridenMethodToBridge, SourceTypeB this.declaringClass = declaringClass; this.selector = overridenMethodToBridge.selector; // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794) - this.modifiers = (overridenMethodToBridge.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccSynchronized | ClassFileConstants.AccAbstract | ClassFileConstants.AccNative | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature); + this.modifiers = (overridenMethodToBridge.modifiers | Flags.ACC_BRIDGE | Flags.SYNTHETIC) & ~(Flags.SYNCHRONIZED | Flags.ABSTRACT | Flags.NATIVE | Flags.FINAL | ExtraCompilerModifiers.AccGenericSignature); this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.returnType = overridenMethodToBridge.returnType; this.parameters = overridenMethodToBridge.parameters; @@ -365,7 +366,7 @@ public SyntheticMethodBinding(MethodBinding overridenMethodToBridge, SourceTypeB public SyntheticMethodBinding(int purpose, ArrayBinding arrayType, char [] selector, SourceTypeBinding declaringClass) { this.declaringClass = declaringClass; this.selector = selector; - this.modifiers = ClassFileConstants.AccSynthetic | ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic; + this.modifiers = Flags.SYNTHETIC | Flags.PRIVATE | Flags.STATIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.returnType = arrayType; LookupEnvironment environment = declaringClass.environment; @@ -417,7 +418,7 @@ public SyntheticMethodBinding(ReferenceExpression ref, SourceTypeBinding declari public SyntheticMethodBinding(MethodBinding privateConstructor, MethodBinding publicConstructor, char[] selector, TypeBinding[] enclosingInstances, SourceTypeBinding declaringClass) { this.declaringClass = declaringClass; this.selector = selector; - this.modifiers = ClassFileConstants.AccSynthetic | ClassFileConstants.AccPrivate | ClassFileConstants.AccStatic; + this.modifiers = Flags.SYNTHETIC | Flags.PRIVATE | Flags.STATIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.returnType = publicConstructor.declaringClass; @@ -439,9 +440,9 @@ public SyntheticMethodBinding(ReferenceBinding declaringClass, RecordComponentBi SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass; assert declaringSourceType.isRecord(); this.declaringClass = declaringSourceType; - this.modifiers = declaringClass.modifiers & (ClassFileConstants.AccPublic|ClassFileConstants.AccPrivate|ClassFileConstants.AccProtected); + this.modifiers = declaringClass.modifiers & (Flags.PUBLIC|Flags.PRIVATE|Flags.PROTECTED); if (this.declaringClass.isStrictfp()) - this.modifiers |= ClassFileConstants.AccStrictfp; + this.modifiers |= Flags.STRICTFP; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.extendedTagBits |= ExtendedTagBits.IsCanonicalConstructor; this.extendedTagBits |= ExtendedTagBits.isImplicit; @@ -458,13 +459,13 @@ public SyntheticMethodBinding(ReferenceBinding declaringClass, RecordComponentBi SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass; assert declaringSourceType.isRecord(); this.declaringClass = declaringSourceType; - this.modifiers = ClassFileConstants.AccPublic; + this.modifiers = Flags.PUBLIC; // rcb not resolved fully yet - to be filled in later - see STB.components() // if (rcb.type instanceof TypeVariableBinding || // rcb.type instanceof ParameterizedTypeBinding) // this.modifiers |= ExtraCompilerModifiers.AccGenericSignature; if (this.declaringClass.isStrictfp()) - this.modifiers |= ClassFileConstants.AccStrictfp; + this.modifiers |= Flags.STRICTFP; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.parameters = Binding.NO_PARAMETERS; // this.returnType = rcb.type; Not resolved yet - to be filled in later @@ -481,9 +482,9 @@ public SyntheticMethodBinding(ReferenceBinding declaringClass, char[] selector, SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass; assert declaringSourceType.isRecord(); this.declaringClass = declaringSourceType; - this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccFinal; + this.modifiers = Flags.PUBLIC | Flags.FINAL; if (this.declaringClass.isStrictfp()) - this.modifiers |= ClassFileConstants.AccStrictfp; + this.modifiers |= Flags.STRICTFP; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); this.selector = selector; this.thrownExceptions = Binding.NO_EXCEPTIONS; @@ -509,7 +510,7 @@ public SyntheticMethodBinding(ReferenceBinding declaringClass, char[] selector, public void initializeConstructorAccessor(MethodBinding accessedConstructor) { this.targetMethod = accessedConstructor; - this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccSynthetic; + this.modifiers = 0 | Flags.SYNTHETIC; this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); SourceTypeBinding sourceType = (SourceTypeBinding) accessedConstructor.declaringClass; SyntheticMethodBinding[] knownSyntheticMethods = sourceType.syntheticMethods(); // returns synthetic methods sorted with index. @@ -588,12 +589,12 @@ public void initializeMethodAccessor(MethodBinding accessedMethod, boolean isSup this.targetMethod = accessedMethod; if (isSuperAccess && receiverType.isInterface() && !accessedMethod.isStatic()) - this.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccSynthetic; + this.modifiers = Flags.PRIVATE | Flags.SYNTHETIC; else { if (receiverType.isInterface()) // default is not allowed. TODO: do we need a target level check here? - this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; + this.modifiers = Flags.PUBLIC | Flags.STATIC | Flags.SYNTHETIC; else - this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; + this.modifiers = 0 | Flags.STATIC | Flags.SYNTHETIC; } this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); SourceTypeBinding declaringSourceType = (SourceTypeBinding) receiverType; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java index 0c8c7e48c88..06ded9e7eb6 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java @@ -53,10 +53,11 @@ import org.eclipse.jdt.internal.compiler.ast.TypeParameter; import org.eclipse.jdt.internal.compiler.ast.TypeReference; import org.eclipse.jdt.internal.compiler.ast.Wildcard; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.lookup.TypeConstants.BoundCheckStatus; +import com.sun.tools.javac.code.Flags; + /** * Binding for a type parameter, held by source/binary type or method. */ @@ -81,7 +82,7 @@ public TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank this.sourceName = sourceName; this.declaringElement = declaringElement; this.rank = rank; - this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public + this.modifiers = Flags.PUBLIC | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public this.tagBits |= TagBits.HasTypeVariable; this.environment = environment; this.typeBits = TypeIds.BitUninitialized; @@ -91,7 +92,7 @@ public TypeVariableBinding(char[] sourceName, Binding declaringElement, int rank // for subclass CaptureBinding protected TypeVariableBinding(char[] sourceName, LookupEnvironment environment) { this.sourceName = sourceName; - this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public + this.modifiers = Flags.PUBLIC | ExtraCompilerModifiers.AccGenericSignature; // treat type var as public this.tagBits |= TagBits.HasTypeVariable; this.environment = environment; this.typeBits = TypeIds.BitUninitialized; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java index f24410637ee..9eabe0b3211 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/VariableBinding.java @@ -18,9 +18,10 @@ package org.eclipse.jdt.internal.compiler.lookup; import org.eclipse.jdt.internal.compiler.ast.ASTNode; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; +import com.sun.tools.javac.code.Flags; + public abstract class VariableBinding extends Binding { public int modifiers; @@ -64,7 +65,7 @@ public final boolean isBlankFinal(){ * marked as implicitly final. */ public final boolean isFinal() { - return (this.modifiers & ClassFileConstants.AccFinal) != 0; + return (this.modifiers & Flags.FINAL) != 0; } public final boolean isEffectivelyFinal() { diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java index eefed9a1572..76b72687941 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java @@ -33,9 +33,10 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.Wildcard; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import com.sun.tools.javac.code.Flags; + /* * A wildcard acts as an argument for parameterized types, allowing to * abstract parameterized types, e.g. List is not compatible with List, @@ -60,7 +61,7 @@ public class WildcardBinding extends ReferenceBinding { public WildcardBinding(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind, LookupEnvironment environment) { this.rank = rank; this.boundKind = boundKind; - this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat wildcard as public + this.modifiers = Flags.PUBLIC | ExtraCompilerModifiers.AccGenericSignature; // treat wildcard as public this.environment = environment; initialize(genericType, bound, otherBounds); if (genericType instanceof UnresolvedReferenceBinding) diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java index 9cea370a5ae..2a0e3dc5b71 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java @@ -77,6 +77,8 @@ import org.eclipse.jdt.internal.compiler.util.Messages; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({"rawtypes", "unchecked"}) public class Parser implements TerminalTokens, ParserBasicInformation, ConflictedParser, OperatorIds, TypeIds { @@ -1160,7 +1162,7 @@ public RecoveredElement buildInitialRecoveryState(){ continue; } if (node instanceof TypeDeclaration type){ - if ((type.modifiers & ClassFileConstants.AccEnum) != 0) { + if ((type.modifiers & Flags.ENUM) != 0) { // do not allow enums to be build as recovery types // https://bugs.eclipse.org/bugs/show_bug.cgi?id=340691 continue; @@ -1225,7 +1227,7 @@ protected void checkAndSetModifiers(int flag){ of a list of several modifiers. The startPosition is zeroed when a copy of modifiers-buffer is push onto the this.astStack. */ - if (flag == ClassFileConstants.AccStrictfp && this.parsingJava17Plus) { + if (flag == Flags.STRICTFP && this.parsingJava17Plus) { problemReporter().StrictfpNotRequired(this.scanner.startPosition, this.scanner.currentPosition - 1); } @@ -1628,7 +1630,7 @@ protected void consumeAnnotationTypeDeclarationHeaderName() { this.intPtr--; // remove the end position of the interface token annotationTypeDeclaration.modifiersSourceStart = this.intStack[this.intPtr--]; - annotationTypeDeclaration.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface; + annotationTypeDeclaration.modifiers = this.intStack[this.intPtr--] | Flags.ANNOTATION | Flags.INTERFACE; if (annotationTypeDeclaration.modifiersSourceStart >= 0) { annotationTypeDeclaration.declarationSourceStart = annotationTypeDeclaration.modifiersSourceStart; this.intPtr--; // remove the position of the '@' token as we have modifiers @@ -1717,7 +1719,7 @@ protected void consumeAnnotationTypeDeclarationHeaderNameWithTypeParameters() { this.intPtr--; // remove the end position of the interface token annotationTypeDeclaration.modifiersSourceStart = this.intStack[this.intPtr--]; - annotationTypeDeclaration.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface; + annotationTypeDeclaration.modifiers = this.intStack[this.intPtr--] | Flags.ANNOTATION | Flags.INTERFACE; if (annotationTypeDeclaration.modifiersSourceStart >= 0) { annotationTypeDeclaration.declarationSourceStart = annotationTypeDeclaration.modifiersSourceStart; this.intPtr--; // remove the position of the '@' token as we have modifiers @@ -3991,7 +3993,7 @@ protected void consumeEnumHeaderName() { this.intPtr--; // remove the end position of the class token enumDeclaration.modifiersSourceStart = this.intStack[this.intPtr--]; - enumDeclaration.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccEnum; + enumDeclaration.modifiers = this.intStack[this.intPtr--] | Flags.ENUM; if (enumDeclaration.modifiersSourceStart >= 0) { enumDeclaration.declarationSourceStart = enumDeclaration.modifiersSourceStart; } @@ -4078,7 +4080,7 @@ protected void consumeEnumHeaderNameWithTypeParameters() { this.intPtr--; // remove the end position of the class token enumDeclaration.modifiersSourceStart = this.intStack[this.intPtr--]; - enumDeclaration.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccEnum; + enumDeclaration.modifiers = this.intStack[this.intPtr--] | Flags.ENUM; if (enumDeclaration.modifiersSourceStart >= 0) { enumDeclaration.declarationSourceStart = enumDeclaration.modifiersSourceStart; } @@ -4792,7 +4794,7 @@ protected void consumeInterfaceHeaderName1() { typeDecl.declarationSourceStart = this.intStack[this.intPtr--]; this.intPtr--; // remove the end position of the class token typeDecl.modifiersSourceStart = this.intStack[this.intPtr--]; - typeDecl.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccInterface; + typeDecl.modifiers = this.intStack[this.intPtr--] | Flags.INTERFACE; if (typeDecl.modifiersSourceStart >= 0) { typeDecl.declarationSourceStart = typeDecl.modifiersSourceStart; } @@ -5029,8 +5031,8 @@ protected void consumeInterfaceMethodDeclaration(boolean hasSemicolonBody) { md.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition); boolean isDefault = (md.modifiers & ExtraCompilerModifiers.AccDefaultMethod) != 0; - boolean isStatic = (md.modifiers & ClassFileConstants.AccStatic) != 0; - boolean isPrivate = (md.modifiers & ClassFileConstants.AccPrivate) != 0; + boolean isStatic = (md.modifiers & Flags.STATIC) != 0; + boolean isPrivate = (md.modifiers & Flags.PRIVATE) != 0; boolean bodyAllowed = (this.parsingJava9Plus && isPrivate) || isDefault || isStatic; if (this.parsingJava8Plus) { if (bodyAllowed && hasSemicolonBody) { @@ -6002,7 +6004,7 @@ protected void consumeSinglePkgName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = new ImportReference(tokens, positions, false, ClassFileConstants.AccDefault)); + pushOnAstStack(impt = new ImportReference(tokens, positions, false, 0)); // recovery if (this.currentElement instanceof RecoveredModule){ @@ -6338,7 +6340,7 @@ protected void consumePackageDeclarationName() { 0, length); - impt = new ImportReference(tokens, positions, false, ClassFileConstants.AccDefault); + impt = new ImportReference(tokens, positions, false, 0); this.compilationUnit.currentPackage = impt; if (this.currentToken == TokenNameSEMICOLON){ @@ -6619,11 +6621,11 @@ protected void consumeRecoveryMethodHeaderName() { // this method is call only inside recovery boolean isAnnotationMethod = false; if(this.currentElement instanceof RecoveredType recoveredType) { - isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0; + isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & Flags.ANNOTATION) != 0; } else { RecoveredType recoveredType = this.currentElement.enclosingType(); if(recoveredType != null) { - isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0; + isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & Flags.ANNOTATION) != 0; } } consumeMethodHeaderName(isAnnotationMethod); @@ -6632,11 +6634,11 @@ protected void consumeRecoveryMethodHeaderNameWithTypeParameters() { // this method is call only inside recovery boolean isAnnotationMethod = false; if(this.currentElement instanceof RecoveredType recoveredType) { - isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0; + isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & Flags.ANNOTATION) != 0; } else { RecoveredType recoveredType = this.currentElement.enclosingType(); if(recoveredType != null) { - isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0; + isAnnotationMethod = (recoveredType.typeDeclaration.modifiers & Flags.ANNOTATION) != 0; } } consumeMethodHeaderNameWithTypeParameters(isAnnotationMethod); @@ -9170,7 +9172,7 @@ protected Argument typeElidedArgument() { identifierName, namePositions, null, // elided type - ClassFileConstants.AccDefault, + 0, true); arg.declarationSourceStart = (int) (namePositions >>> 32); return arg; @@ -9181,7 +9183,7 @@ protected void consumeTypeElidedLambdaParameter(boolean parenthesized) { // LambdaParameters ::= Identifier // TypeElidedFormalParameter ::= Modifiersopt Identifier - int modifier = ClassFileConstants.AccDefault; + int modifier = 0; int annotationLength = 0; int modifiersStart = 0; if (parenthesized) { // The grammar is permissive enough to allow optional modifiers for the parenthesized version, they should be rejected if present. @@ -9193,7 +9195,7 @@ protected void consumeTypeElidedLambdaParameter(boolean parenthesized) { } Argument arg = typeElidedArgument(); - if (modifier != ClassFileConstants.AccDefault || annotationLength != 0) { + if (modifier != 0 || annotationLength != 0) { problemReporter().illegalModifiersForElidedType(arg); arg.declarationSourceStart = modifiersStart; } @@ -9463,9 +9465,9 @@ protected void consumeSingleStaticImportDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = new ImportReference(tokens, positions, false, ClassFileConstants.AccStatic)); + pushOnAstStack(impt = new ImportReference(tokens, positions, false, Flags.STATIC)); - this.modifiers = ClassFileConstants.AccDefault; + this.modifiers = 0; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) if (this.currentToken == TokenNameSEMICOLON){ @@ -9480,7 +9482,7 @@ protected void consumeSingleStaticImportDeclarationName() { if(!this.statementRecoveryActivated && this.options.sourceLevel < ClassFileConstants.JDK1_5 && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { - impt.modifiers = ClassFileConstants.AccDefault; // convert the static import reference to a non-static importe reference + impt.modifiers = 0; // convert the static import reference to a non-static importe reference problemReporter().invalidUsageOfStaticImports(impt); } @@ -9504,7 +9506,7 @@ protected void consumeSingleTypeImportDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = new ImportReference(tokens, positions, false, ClassFileConstants.AccDefault)); + pushOnAstStack(impt = new ImportReference(tokens, positions, false, 0)); if (this.currentToken == TokenNameSEMICOLON){ impt.declarationSourceEnd = this.scanner.currentPosition - 1; @@ -9805,7 +9807,7 @@ protected void consumeStatementSynchronized() { this.intStack[this.intPtr--], this.endStatementPosition); } - this.modifiers = ClassFileConstants.AccDefault; + this.modifiers = 0; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) } protected void consumeStatementThrow() { @@ -9899,11 +9901,11 @@ protected void consumeStaticImportOnDemandDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccStatic)); + pushOnAstStack(impt = new ImportReference(tokens, positions, true, Flags.STATIC)); // star end position impt.trailingStarPosition = this.intStack[this.intPtr--]; - this.modifiers = ClassFileConstants.AccDefault; + this.modifiers = 0; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) if (this.currentToken == TokenNameSEMICOLON){ @@ -9918,7 +9920,7 @@ protected void consumeStaticImportOnDemandDeclarationName() { if(!this.statementRecoveryActivated && this.options.sourceLevel < ClassFileConstants.JDK1_5 && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { - impt.modifiers = ClassFileConstants.AccDefault; // convert the static import reference to a non-static importe reference + impt.modifiers = 0; // convert the static import reference to a non-static importe reference problemReporter().invalidUsageOfStaticImports(impt); } @@ -9936,7 +9938,7 @@ protected void consumeStaticInitializer() { //optimize the push/pop Block block = (Block) this.astStack[this.astPtr]; if (this.diet) block.bits &= ~ASTNode.UndocumentedEmptyBlock; // clear bit set since was diet - Initializer initializer = new Initializer(block, ClassFileConstants.AccStatic); + Initializer initializer = new Initializer(block, Flags.STATIC); this.astStack[this.astPtr] = initializer; initializer.sourceEnd = this.endStatementPosition; initializer.declarationSourceEnd = flushCommentsDefinedPriorTo(this.endStatementPosition); @@ -10273,19 +10275,19 @@ protected void consumeToken(int type) { pushOnIntStack(this.scanner.startPosition); break; case TokenNameabstract : - checkAndSetModifiers(ClassFileConstants.AccAbstract); + checkAndSetModifiers(Flags.ABSTRACT); pushOnExpressionStackLengthStack(0); break; case TokenNamestrictfp : - checkAndSetModifiers(ClassFileConstants.AccStrictfp); + checkAndSetModifiers(Flags.STRICTFP); pushOnExpressionStackLengthStack(0); break; case TokenNamefinal : - checkAndSetModifiers(ClassFileConstants.AccFinal); + checkAndSetModifiers(Flags.FINAL); pushOnExpressionStackLengthStack(0); break; case TokenNamenative : - checkAndSetModifiers(ClassFileConstants.AccNative); + checkAndSetModifiers(Flags.NATIVE); pushOnExpressionStackLengthStack(0); break; case TokenNamenon_sealed : @@ -10297,15 +10299,15 @@ protected void consumeToken(int type) { pushOnExpressionStackLengthStack(0); break; case TokenNameprivate : - checkAndSetModifiers(ClassFileConstants.AccPrivate); + checkAndSetModifiers(Flags.PRIVATE); pushOnExpressionStackLengthStack(0); break; case TokenNameprotected : - checkAndSetModifiers(ClassFileConstants.AccProtected); + checkAndSetModifiers(Flags.PROTECTED); pushOnExpressionStackLengthStack(0); break; case TokenNamepublic : - checkAndSetModifiers(ClassFileConstants.AccPublic); + checkAndSetModifiers(Flags.PUBLIC); pushOnExpressionStackLengthStack(0); break; case TokenNameRestrictedIdentifiersealed : @@ -10316,7 +10318,7 @@ protected void consumeToken(int type) { pushOnIntStack(this.scanner.startPosition); break; case TokenNametransient : - checkAndSetModifiers(ClassFileConstants.AccTransient); + checkAndSetModifiers(Flags.TRANSIENT); pushOnExpressionStackLengthStack(0); break; case TokenNametransitive : @@ -10324,19 +10326,19 @@ protected void consumeToken(int type) { pushOnExpressionStackLengthStack(0); break; case TokenNamevolatile : - checkAndSetModifiers(ClassFileConstants.AccVolatile); + checkAndSetModifiers(Flags.VOLATILE); pushOnExpressionStackLengthStack(0); break; case TokenNamestatic : if (isParsingModuleDeclaration()) checkAndSetModifiers(ClassFileConstants.ACC_STATIC_PHASE); else - checkAndSetModifiers(ClassFileConstants.AccStatic); + checkAndSetModifiers(Flags.STATIC); pushOnExpressionStackLengthStack(0); break; case TokenNamesynchronized : this.synchronizedBlockSourceStart = this.scanner.startPosition; - checkAndSetModifiers(ClassFileConstants.AccSynchronized); + checkAndSetModifiers(Flags.SYNCHRONIZED); pushOnExpressionStackLengthStack(0); break; //============================== @@ -10707,7 +10709,7 @@ protected void consumeTypeImportOnDemandDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccDefault)); + pushOnAstStack(impt = new ImportReference(tokens, positions, true, 0)); // star end position impt.trailingStarPosition = this.intStack[this.intPtr--]; @@ -11280,7 +11282,7 @@ private void convertToFields(TypeDeclaration typeDecl, RecordComponent[] recComp f.declarationSourceEnd = recComp.declarationSourceEnd; f.endPart1Position = recComp.sourceEnd; //TODO BETA_JAVA14 - recheck f.endPart2Position = recComp.declarationSourceEnd; - f.modifiers = ClassFileConstants.AccPrivate | ClassFileConstants.AccFinal; + f.modifiers = Flags.PRIVATE | Flags.FINAL; // Note: JVMS 14 S 4.7.8 The Synthetic Attribute mandates do not mark Synthetic for Record compoents. // hence marking this "explicitly" as implicit. f.isARecordComponent = true; @@ -11296,7 +11298,7 @@ private void convertToFields(TypeDeclaration typeDecl, RecordComponent[] recComp * An implicitly declared private final field with the same name as the record * component and the type as the declared type of the record component. */ - f.modifiers |= ClassFileConstants.AccPrivate | ClassFileConstants.AccFinal; + f.modifiers |= Flags.PRIVATE | Flags.FINAL; f.modifiers |= ExtraCompilerModifiers.AccRecord; f.modifiersSourceStart = recComp.modifiersSourceStart; f.sourceStart = recComp.sourceStart; @@ -11651,7 +11653,7 @@ private void checkForRecordMemberErrors(TypeDeclaration typeDecl, int nCreatedFi if (typeDecl.methods != null) { for (int i = 0; i < typeDecl.methods.length; i++) { AbstractMethodDeclaration method = typeDecl.methods[i]; - if ((method.modifiers & ClassFileConstants.AccNative) != 0) { + if ((method.modifiers & Flags.NATIVE) != 0) { problemReporter().recordIllegalNativeModifierInRecord(method); } } @@ -14414,7 +14416,7 @@ private void reportSyntaxErrorsForSkippedMethod(TypeDeclaration[] types){ * Reset modifiers buffer and comment stack. Should be call only for nodes that claim both. */ protected void resetModifiers() { - this.modifiers = ClassFileConstants.AccDefault; + this.modifiers = 0; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) this.annotationAsModifierSourceStart = -1; this.scanner.commentPtr = -1; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java index 6998df0018f..020b4719e96 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredBlock.java @@ -15,19 +15,20 @@ import java.util.HashSet; import java.util.Set; -import org.eclipse.jdt.core.compiler.*; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.Argument; -import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; import org.eclipse.jdt.internal.compiler.ast.ForeachStatement; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import com.sun.tools.javac.code.Flags; + public class RecoveredBlock extends RecoveredStatement implements TerminalTokens { public Block blockDeclaration; @@ -459,7 +460,7 @@ public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanc /* local variables inside method can only be final and non void */ char[][] fieldTypeName; - if ((fieldDeclaration.modifiers & ~ClassFileConstants.AccFinal) != 0 // local var can only be final + if ((fieldDeclaration.modifiers & ~Flags.FINAL) != 0 // local var can only be final || (fieldDeclaration.type == null) // initializer || ((fieldTypeName = fieldDeclaration.type.getTypeName()).length == 1 // non void && CharOperation.equals(fieldTypeName[0], TypeBinding.VOID.sourceName()))){ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java index d770857db80..577a05b57f9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredInitializer.java @@ -15,7 +15,7 @@ import java.util.Set; -import org.eclipse.jdt.core.compiler.*; +import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.FieldDeclaration; @@ -23,9 +23,10 @@ import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.jdt.internal.compiler.ast.Statement; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; +import com.sun.tools.javac.code.Flags; + public class RecoveredInitializer extends RecoveredField implements TerminalTokens { public RecoveredType[] localTypes; @@ -82,7 +83,7 @@ public RecoveredElement add(FieldDeclaration newFieldDeclaration, int bracketBal /* local variables inside initializer can only be final and non void */ char[][] fieldTypeName; - if ((newFieldDeclaration.modifiers & ~ClassFileConstants.AccFinal) != 0 /* local var can only be final */ + if ((newFieldDeclaration.modifiers & ~Flags.FINAL) != 0 /* local var can only be final */ || (newFieldDeclaration.type == null) // initializer || ((fieldTypeName = newFieldDeclaration.type.getTypeName()).length == 1 // non void && CharOperation.equals(fieldTypeName[0], TypeBinding.VOID.sourceName()))){ diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java index 5680910d938..f2268229eb0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredLocalVariable.java @@ -19,10 +19,10 @@ import java.util.HashSet; import java.util.Set; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.ArrayQualifiedTypeReference; import org.eclipse.jdt.internal.compiler.ast.ArrayTypeReference; -import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; import org.eclipse.jdt.internal.compiler.ast.Statement; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java index 3e167b8df9a..b66091e69e0 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredMethod.java @@ -18,11 +18,11 @@ import java.util.HashSet; import java.util.Set; -import org.eclipse.jdt.core.compiler.*; +import org.eclipse.jdt.core.compiler.CharOperation; +import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.Argument; -import org.eclipse.jdt.internal.compiler.ast.ASTNode; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration; import org.eclipse.jdt.internal.compiler.ast.ExplicitConstructorCall; @@ -35,10 +35,11 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeParameter; import org.eclipse.jdt.internal.compiler.ast.TypeReference; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + /** * Internal method structure for parsing recovery */ @@ -117,7 +118,7 @@ public RecoveredElement add(FieldDeclaration fieldDeclaration, int bracketBalanc /* local variables inside method can only be final and non void */ char[][] fieldTypeName; - if ((fieldDeclaration.modifiers & ~ClassFileConstants.AccFinal) != 0 // local var can only be final + if ((fieldDeclaration.modifiers & ~Flags.FINAL) != 0 // local var can only be final || (fieldDeclaration.type == null) // initializer || ((fieldTypeName = fieldDeclaration.type.getTypeName()).length == 1 // non void && CharOperation.equals(fieldTypeName[0], TypeBinding.VOID.sourceName()))){ @@ -494,7 +495,7 @@ public void updateFromParserState(){ Argument argument = (Argument)aNode; /* cannot be an argument if non final */ char[][] argTypeName = argument.type.getTypeName(); - if ((argument.modifiers & ~ClassFileConstants.AccFinal) != 0 + if ((argument.modifiers & ~Flags.FINAL) != 0 || (argTypeName.length == 1 && CharOperation.equals(argTypeName[0], TypeBinding.VOID.sourceName()))){ parser.astLengthStack[parser.astLengthPtr] = count; @@ -647,7 +648,7 @@ public void addModifier(int flag, int modifiersSourceStart) { } } void attach(TypeParameter[] parameters, int startPos) { - if(this.methodDeclaration.modifiers != ClassFileConstants.AccDefault) return; + if(this.methodDeclaration.modifiers != 0) return; int lastParameterEnd = parameters[parameters.length - 1].sourceEnd; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java index 5a3ccddf0ad..5a76440e6c2 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredType.java @@ -19,8 +19,8 @@ import java.util.HashSet; import java.util.Set; -import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.AbstractVariableDeclaration; import org.eclipse.jdt.internal.compiler.ast.Annotation; import org.eclipse.jdt.internal.compiler.ast.Block; @@ -31,7 +31,8 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeParameter; import org.eclipse.jdt.internal.compiler.ast.TypeReference; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; /** * Internal type structure for parsing recovery @@ -144,9 +145,9 @@ public RecoveredElement add(Block nestedBlockDeclaration,int bracketBalanceValue this.pendingTypeParameters = null; resetPendingModifiers(); - int mods = ClassFileConstants.AccDefault; + int mods = 0; if(parser().recoveredStaticInitializerStart != 0) { - mods = ClassFileConstants.AccStatic; + mods = Flags.STATIC; } return this.add(new Initializer(nestedBlockDeclaration, mods), bracketBalanceValue); } @@ -820,9 +821,9 @@ public RecoveredElement updateOnOpeningBrace(int braceStart, int braceEnd){ block.sourceStart = parser.scanner.startPosition; Initializer init; if (parser.recoveredStaticInitializerStart == 0){ - init = new Initializer(block, ClassFileConstants.AccDefault); + init = new Initializer(block, 0); } else { - init = new Initializer(block, ClassFileConstants.AccStatic); + init = new Initializer(block, Flags.STATIC); init.declarationSourceStart = parser.recoveredStaticInitializerStart; } init.bodyStart = parser.scanner.currentPosition; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java index 6b7f3d6bd88..68ee18be57f 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveredUnit.java @@ -19,8 +19,8 @@ import java.util.HashSet; import java.util.Set; -import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.ASTNode; +import org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; import org.eclipse.jdt.internal.compiler.ast.Block; import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration; import org.eclipse.jdt.internal.compiler.ast.ExportsStatement; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java index 933ba79283f..d91192fc768 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/RecoveryScanner.java @@ -15,6 +15,7 @@ package org.eclipse.jdt.internal.compiler.parser; import java.util.Arrays; + import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.InvalidInputException; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java index e4030abbc32..3626a5b51d2 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/DefaultProblemFactory.java @@ -18,7 +18,8 @@ import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.eclipse.jdt.core.compiler.*; +import org.eclipse.jdt.core.compiler.CategorizedProblem; +import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.internal.compiler.IProblemFactory; import org.eclipse.jdt.internal.compiler.util.HashtableOfInt; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java index e2ec82591d4..d54285f6aa9 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java @@ -86,8 +86,8 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; -import java.util.Set; import java.util.Map; +import java.util.Set; import java.util.function.Supplier; import java.util.stream.Collectors; @@ -219,6 +219,8 @@ import org.eclipse.jdt.internal.compiler.util.Messages; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings("rawtypes") public class ProblemReporter extends ProblemHandler { @@ -2933,11 +2935,11 @@ public void illegalLocalTypeDeclaration(TypeDeclaration typeDeclaration) { if (isRecoveredName(typeDeclaration.name)) return; int problemID = 0; - if ((typeDeclaration.modifiers & ClassFileConstants.AccEnum) != 0) { + if ((typeDeclaration.modifiers & Flags.ENUM) != 0) { problemID = IProblem.CannotDefineEnumInLocalType; - } else if ((typeDeclaration.modifiers & ClassFileConstants.AccAnnotation) != 0) { + } else if ((typeDeclaration.modifiers & Flags.ANNOTATION) != 0) { problemID = IProblem.CannotDefineAnnotationInLocalType; - } else if ((typeDeclaration.modifiers & ClassFileConstants.AccInterface) != 0) { + } else if ((typeDeclaration.modifiers & Flags.INTERFACE) != 0) { problemID = IProblem.CannotDefineInterfaceInLocalType; } else if (typeDeclaration.isRecord()) { problemID = IProblem.RecordCannotDefineRecordInLocalType; @@ -6196,14 +6198,14 @@ public void javadocUnterminatedInlineTag(int sourceStart, int sourceEnd) { private boolean javadocVisibility(int visibility, int modifiers) { if (modifiers < 0) return true; switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) { - case ClassFileConstants.AccPublic : + case Flags.PUBLIC: return true; - case ClassFileConstants.AccProtected: - return (visibility != ClassFileConstants.AccPublic); - case ClassFileConstants.AccDefault: - return (visibility == ClassFileConstants.AccDefault || visibility == ClassFileConstants.AccPrivate); - case ClassFileConstants.AccPrivate: - return (visibility == ClassFileConstants.AccPrivate); + case Flags.PROTECTED: + return (visibility != Flags.PUBLIC); + case 0: + return (visibility == 0 || visibility == Flags.PRIVATE); + case Flags.PRIVATE: + return (visibility == Flags.PRIVATE); } return true; } @@ -6211,21 +6213,21 @@ private boolean javadocVisibility(int visibility, int modifiers) { private String javadocVisibilityArgument(int visibility, int modifiers) { String argument = null; switch (modifiers & ExtraCompilerModifiers.AccVisibilityMASK) { - case ClassFileConstants.AccPublic : + case Flags.PUBLIC: argument = CompilerOptions.PUBLIC; break; - case ClassFileConstants.AccProtected: - if (visibility != ClassFileConstants.AccPublic) { + case Flags.PROTECTED: + if (visibility != Flags.PUBLIC) { argument = CompilerOptions.PROTECTED; } break; - case ClassFileConstants.AccDefault: - if (visibility == ClassFileConstants.AccDefault || visibility == ClassFileConstants.AccPrivate) { + case 0: + if (visibility == 0 || visibility == Flags.PRIVATE) { argument = CompilerOptions.DEFAULT; } break; - case ClassFileConstants.AccPrivate: - if (visibility == ClassFileConstants.AccPrivate) { + case Flags.PRIVATE: + if (visibility == Flags.PRIVATE) { argument = CompilerOptions.PRIVATE; } break; @@ -6701,7 +6703,7 @@ public void methodNeedBody(AbstractMethodDeclaration methodDecl) { public void methodNeedingNoBody(MethodDeclaration methodDecl) { this.handle( - ((methodDecl.modifiers & ClassFileConstants.AccNative) != 0) ? IProblem.BodyForNativeMethod : IProblem.BodyForAbstractMethod, + ((methodDecl.modifiers & Flags.NATIVE) != 0) ? IProblem.BodyForNativeMethod : IProblem.BodyForAbstractMethod, NoArgument, NoArgument, methodDecl.sourceStart, diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/ArchiveFileObject.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/ArchiveFileObject.java index 09626e46593..109ef25b8ce 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/ArchiveFileObject.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/ArchiveFileObject.java @@ -30,11 +30,12 @@ import javax.lang.model.element.NestingKind; import javax.tools.JavaFileObject; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; import org.eclipse.jdt.internal.compiler.util.JRTUtil; +import com.sun.tools.javac.code.Flags; + /** * Implementation of a Java file object that corresponds to an entry in a zip/jar file */ @@ -64,13 +65,13 @@ public Modifier getAccessLevel() { return null; } final int accessFlags = reader.accessFlags(); - if ((accessFlags & ClassFileConstants.AccPublic) != 0) { + if ((accessFlags & Flags.PUBLIC) != 0) { return Modifier.PUBLIC; } - if ((accessFlags & ClassFileConstants.AccAbstract) != 0) { + if ((accessFlags & Flags.ABSTRACT) != 0) { return Modifier.ABSTRACT; } - if ((accessFlags & ClassFileConstants.AccFinal) != 0) { + if ((accessFlags & Flags.FINAL) != 0) { return Modifier.FINAL; } return null; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java index c70520f7deb..a7557479eac 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/EclipseFileObject.java @@ -36,11 +36,12 @@ import javax.lang.model.element.NestingKind; import javax.tools.SimpleJavaFileObject; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; import org.eclipse.jdt.internal.compiler.util.JRTUtil; +import com.sun.tools.javac.code.Flags; + /** * Implementation of a Java file object that corresponds to a file on the file system */ @@ -83,13 +84,13 @@ public Modifier getAccessLevel() { return null; } final int accessFlags = reader.accessFlags(); - if ((accessFlags & ClassFileConstants.AccPublic) != 0) { + if ((accessFlags & Flags.PUBLIC) != 0) { return Modifier.PUBLIC; } - if ((accessFlags & ClassFileConstants.AccAbstract) != 0) { + if ((accessFlags & Flags.ABSTRACT) != 0) { return Modifier.ABSTRACT; } - if ((accessFlags & ClassFileConstants.AccFinal) != 0) { + if ((accessFlags & Flags.FINAL) != 0) { return Modifier.FINAL; } return null; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java index 2470b93ed74..f7855a07af3 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/tool/PathFileObject.java @@ -28,11 +28,12 @@ import javax.lang.model.element.NestingKind; import javax.tools.JavaFileObject; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; import org.eclipse.jdt.internal.compiler.util.JRTUtil; +import com.sun.tools.javac.code.Flags; + /** * Implementation of a Java file object that corresponds to a file on the file system */ @@ -74,13 +75,13 @@ public Modifier getAccessLevel() { return null; } final int accessFlags = reader.accessFlags(); - if ((accessFlags & ClassFileConstants.AccPublic) != 0) { + if ((accessFlags & Flags.PUBLIC) != 0) { return Modifier.PUBLIC; } - if ((accessFlags & ClassFileConstants.AccAbstract) != 0) { + if ((accessFlags & Flags.ABSTRACT) != 0) { return Modifier.ABSTRACT; } - if ((accessFlags & ClassFileConstants.AccFinal) != 0) { + if ((accessFlags & Flags.FINAL) != 0) { return Modifier.FINAL; } return null; diff --git a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java index 27c21a53009..53710e90a26 100644 --- a/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java +++ b/org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/util/Util.java @@ -59,6 +59,8 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; +import com.sun.tools.javac.code.Flags; + public class Util implements SuffixConstants { /** @@ -381,17 +383,17 @@ public static char[] bytesToChar(byte[] bytes, String encoding) throws IOExcepti public static int computeOuterMostVisibility(TypeDeclaration typeDeclaration, int visibility) { while (typeDeclaration != null) { switch (typeDeclaration.modifiers & ExtraCompilerModifiers.AccVisibilityMASK) { - case ClassFileConstants.AccPrivate: - visibility = ClassFileConstants.AccPrivate; + case Flags.PRIVATE: + visibility = Flags.PRIVATE; break; - case ClassFileConstants.AccDefault: - if (visibility != ClassFileConstants.AccPrivate) { - visibility = ClassFileConstants.AccDefault; + case 0: + if (visibility != Flags.PRIVATE) { + visibility = 0; } break; - case ClassFileConstants.AccProtected: - if (visibility == ClassFileConstants.AccPublic) { - visibility = ClassFileConstants.AccProtected; + case Flags.PROTECTED: + if (visibility == Flags.PUBLIC) { + visibility = 0; } break; } diff --git a/org.eclipse.jdt.core.tests.compiler/.classpath b/org.eclipse.jdt.core.tests.compiler/.classpath index 427e49b0d47..e0fbda8d779 100644 --- a/org.eclipse.jdt.core.tests.compiler/.classpath +++ b/org.eclipse.jdt.core.tests.compiler/.classpath @@ -3,6 +3,7 @@ + diff --git a/org.eclipse.jdt.core.tests.compiler/pom.xml b/org.eclipse.jdt.core.tests.compiler/pom.xml index 8393a094625..59e4e8f395f 100644 --- a/org.eclipse.jdt.core.tests.compiler/pom.xml +++ b/org.eclipse.jdt.core.tests.compiler/pom.xml @@ -28,6 +28,18 @@ + + org.eclipse.tycho + tycho-compiler-plugin + + false + + + --add-exports + jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED,jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED + + + org.eclipse.tycho tycho-surefire-plugin diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java index 627a9a24848..28cf6a6cd5b 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceElementParserTest.java @@ -27,11 +27,12 @@ import org.eclipse.jdt.internal.compiler.ast.Expression; import org.eclipse.jdt.internal.compiler.ast.ImportReference; import org.eclipse.jdt.internal.compiler.batch.CompilationUnit; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({ "unchecked", "rawtypes" }) public class SourceElementParserTest extends AbstractCompilerTest implements ISourceElementRequestor { private SourceType currentType; @@ -181,21 +182,21 @@ public void dietParse(String s, String testName, boolean recordLocalDeclaration) public static String displayModifiers(int modifiers) { StringBuilder buffer = new StringBuilder(); - if ((modifiers & ClassFileConstants.AccPublic) != 0) + if ((modifiers & Flags.PUBLIC) != 0) buffer.append("public "); - if ((modifiers & ClassFileConstants.AccProtected) != 0) + if ((modifiers & Flags.PROTECTED) != 0) buffer.append("protected "); - if ((modifiers & ClassFileConstants.AccPrivate) != 0) + if ((modifiers & Flags.PRIVATE) != 0) buffer.append("private "); - if ((modifiers & ClassFileConstants.AccFinal) != 0) + if ((modifiers & Flags.FINAL) != 0) buffer.append("final "); - if ((modifiers & ClassFileConstants.AccStatic) != 0) + if ((modifiers & Flags.STATIC) != 0) buffer.append("static "); - if ((modifiers & ClassFileConstants.AccAbstract) != 0) + if ((modifiers & Flags.ABSTRACT) != 0) buffer.append("abstract "); - if ((modifiers & ClassFileConstants.AccNative) != 0) + if ((modifiers & Flags.NATIVE) != 0) buffer.append("native "); - if ((modifiers & ClassFileConstants.AccSynchronized) != 0) + if ((modifiers & Flags.SYNCHRONIZED) != 0) buffer.append("synchronized "); return buffer.toString(); } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java index 14e9d87f345..7d32a36ab8a 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceField.java @@ -13,9 +13,10 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.parser; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.ISourceField; +import com.sun.tools.javac.code.Flags; + public class SourceField implements ISourceField { protected int modifiers; protected char[] typeName; @@ -47,21 +48,21 @@ public String displayModifiers() { if (this.modifiers == 0) return null; - if ((this.modifiers & ClassFileConstants.AccPublic) != 0) + if ((this.modifiers & Flags.PUBLIC) != 0) buffer.append("public "); - if ((this.modifiers & ClassFileConstants.AccProtected) != 0) + if ((this.modifiers & Flags.PROTECTED) != 0) buffer.append("protected "); - if ((this.modifiers & ClassFileConstants.AccPrivate) != 0) + if ((this.modifiers & Flags.PRIVATE) != 0) buffer.append("private "); - if ((this.modifiers & ClassFileConstants.AccFinal) != 0) + if ((this.modifiers & Flags.FINAL) != 0) buffer.append("final "); - if ((this.modifiers & ClassFileConstants.AccStatic) != 0) + if ((this.modifiers & Flags.STATIC) != 0) buffer.append("static "); - if ((this.modifiers & ClassFileConstants.AccAbstract) != 0) + if ((this.modifiers & Flags.ABSTRACT) != 0) buffer.append("abstract "); - if ((this.modifiers & ClassFileConstants.AccNative) != 0) + if ((this.modifiers & Flags.NATIVE) != 0) buffer.append("native "); - if ((this.modifiers & ClassFileConstants.AccSynchronized) != 0) + if ((this.modifiers & Flags.SYNCHRONIZED) != 0) buffer.append("synchronized "); return buffer.toString(); } diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java index df4cc464760..581c1cb5a8a 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceInitializer.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.parser; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import com.sun.tools.javac.code.Flags; public class SourceInitializer extends SourceField { public SourceInitializer( @@ -29,7 +29,7 @@ public void setDeclarationSourceEnd(int declarationSourceEnd) { @Override public String toString(int tab) { - if (this.modifiers == ClassFileConstants.AccStatic) { + if (this.modifiers == Flags.STATIC) { return tabString(tab) + "static {}"; } return tabString(tab) + "{}"; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java index 7e2bf6ae116..42dc4d39028 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceMethod.java @@ -13,9 +13,10 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.parser; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.ISourceMethod; +import com.sun.tools.javac.code.Flags; + public class SourceMethod implements ISourceMethod { private int modifiers; private int declarationStart; @@ -60,21 +61,21 @@ public String displayModifiers() { if (this.modifiers == 0) return null; - if ((this.modifiers & ClassFileConstants.AccPublic) != 0) + if ((this.modifiers & Flags.PUBLIC) != 0) buffer.append("public "); - if ((this.modifiers & ClassFileConstants.AccProtected) != 0) + if ((this.modifiers & Flags.PROTECTED) != 0) buffer.append("protected "); - if ((this.modifiers & ClassFileConstants.AccPrivate) != 0) + if ((this.modifiers & Flags.PRIVATE) != 0) buffer.append("private "); - if ((this.modifiers & ClassFileConstants.AccFinal) != 0) + if ((this.modifiers & Flags.FINAL) != 0) buffer.append("final "); - if ((this.modifiers & ClassFileConstants.AccStatic) != 0) + if ((this.modifiers & Flags.STATIC) != 0) buffer.append("static "); - if ((this.modifiers & ClassFileConstants.AccAbstract) != 0) + if ((this.modifiers & Flags.ABSTRACT) != 0) buffer.append("abstract "); - if ((this.modifiers & ClassFileConstants.AccNative) != 0) + if ((this.modifiers & Flags.NATIVE) != 0) buffer.append("native "); - if ((this.modifiers & ClassFileConstants.AccSynchronized) != 0) + if ((this.modifiers & Flags.SYNCHRONIZED) != 0) buffer.append("synchronized "); if (buffer.toString().trim().equals("")) return null; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java index ac6ad0df478..f6d37e16902 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/SourceType.java @@ -13,7 +13,7 @@ *******************************************************************************/ package org.eclipse.jdt.core.tests.compiler.parser; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import com.sun.tools.javac.code.Flags; public final class SourceType { private int modifiers; @@ -125,21 +125,21 @@ public String displayModifiers() { if (this.modifiers == 0) return null; - if ((this.modifiers & ClassFileConstants.AccPublic) != 0) + if ((this.modifiers & Flags.PUBLIC) != 0) buffer.append("public "); - if ((this.modifiers & ClassFileConstants.AccProtected) != 0) + if ((this.modifiers & Flags.PROTECTED) != 0) buffer.append("protected "); - if ((this.modifiers & ClassFileConstants.AccPrivate) != 0) + if ((this.modifiers & Flags.PRIVATE) != 0) buffer.append("private "); - if ((this.modifiers & ClassFileConstants.AccFinal) != 0) + if ((this.modifiers & Flags.FINAL) != 0) buffer.append("final "); - if ((this.modifiers & ClassFileConstants.AccStatic) != 0) + if ((this.modifiers & Flags.STATIC) != 0) buffer.append("static "); - if ((this.modifiers & ClassFileConstants.AccAbstract) != 0) + if ((this.modifiers & Flags.ABSTRACT) != 0) buffer.append("abstract "); - if ((this.modifiers & ClassFileConstants.AccNative) != 0) + if ((this.modifiers & Flags.NATIVE) != 0) buffer.append("native "); - if ((this.modifiers & ClassFileConstants.AccSynchronized) != 0) + if ((this.modifiers & Flags.SYNCHRONIZED) != 0) buffer.append("synchronized "); return buffer.toString().trim(); } @@ -227,10 +227,10 @@ public boolean isBinaryType() { return false; } public boolean isClass() { - return (this.modifiers & ClassFileConstants.AccInterface) == 0; + return (this.modifiers & Flags.INTERFACE) == 0; } public boolean isInterface() { - return (this.modifiers & ClassFileConstants.AccInterface) == ClassFileConstants.AccInterface; + return (this.modifiers & Flags.INTERFACE) == Flags.INTERFACE; } public void setDeclarationSourceEnd(int position) { this.declarationEnd = position; diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_17.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_17.java index 58911a3df10..1ebdef9cdb9 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_17.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ClassFileReaderTest_17.java @@ -19,6 +19,8 @@ import org.eclipse.jdt.internal.compiler.env.IBinaryMethod; import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({ "rawtypes" }) public class ClassFileReaderTest_17 extends AbstractRegressionTest { static { @@ -113,7 +115,7 @@ public void testBug545510_1() throws Exception { org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader classFileReader = getInternalClassFile("", "X", "X", source); int modifiers = classFileReader.getModifiers(); - assertTrue("strictfp modifier not expected", (modifiers & ClassFileConstants.AccStrictfp) == 0); + assertTrue("strictfp modifier not expected", (modifiers & Flags.STRICTFP) == 0); } public void testBug545510_2() throws Exception { String source = @@ -125,7 +127,7 @@ public void testBug545510_2() throws Exception { IBinaryMethod[] methods = classFileReader.getMethods(); IBinaryMethod method = methods[1]; int modifiers = method.getModifiers(); - assertTrue("strictfp modifier not expected", (modifiers & ClassFileConstants.AccStrictfp) == 0); + assertTrue("strictfp modifier not expected", (modifiers & Flags.STRICTFP) == 0); } public void testBug545510_3() throws Exception { String source = @@ -137,7 +139,7 @@ public void testBug545510_3() throws Exception { IBinaryMethod[] methods = classFileReader.getMethods(); IBinaryMethod method = methods[1]; int modifiers = method.getModifiers(); - assertTrue("strictfp modifier not expected", (modifiers & ClassFileConstants.AccStrictfp) == 0); + assertTrue("strictfp modifier not expected", (modifiers & Flags.STRICTFP) == 0); } public void testWildcardBinding() throws Exception { String source = diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ModuleAttributeTests.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ModuleAttributeTests.java index ea630d2ba2d..075e13f0787 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ModuleAttributeTests.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ModuleAttributeTests.java @@ -23,7 +23,8 @@ import org.eclipse.jdt.core.util.IClassFileAttribute; import org.eclipse.jdt.core.util.IClassFileReader; import org.eclipse.jdt.core.util.IModuleAttribute; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; import junit.framework.Test; @@ -134,7 +135,7 @@ public void testBug521521() throws Exception { IClassFileReader cfr = ToolFactory.createDefaultClassFileReader(OUTPUT_DIR + File.separator + "module-info.class", IClassFileReader.CLASSFILE_ATTRIBUTES); assertNotNull("Error reading module-info.class", cfr); int flags = cfr.getAccessFlags(); - assertTrue("Invalid access flags", (flags & ~ClassFileConstants.AccModule) == 0); + assertTrue("Invalid access flags", (flags & ~Flags.ACC_MODULE) == 0); } public void testBug521521a() throws Exception { this.runConformTest( @@ -146,7 +147,7 @@ public void testBug521521a() throws Exception { IClassFileReader cfr = ToolFactory.createDefaultClassFileReader(OUTPUT_DIR + File.separator + "module-info.class", IClassFileReader.CLASSFILE_ATTRIBUTES); assertNotNull("Error reading module-info.class", cfr); int flags = cfr.getAccessFlags(); - assertTrue("Invalid access flags", (flags & ~ClassFileConstants.AccModule) == 0); + assertTrue("Invalid access flags", (flags & ~Flags.ACC_MODULE) == 0); } public void testModuleCompile() throws Exception { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java index 64a71cf2535..031413c1e4d 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java @@ -27,6 +27,8 @@ import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; +import com.sun.tools.javac.code.Flags; + import junit.framework.Test; @SuppressWarnings({ "unchecked", "rawtypes" }) @@ -2270,7 +2272,7 @@ public void test060() { } else if (CharOperation.equals(methodInfos[1].getName(), "varargMethod".toCharArray())) { methodInfo = methodInfos[1]; } - assertTrue("ACC_VARARGS is not set", (methodInfo.getAccessFlags() & ClassFileConstants.AccVarargs) == 0); + assertTrue("ACC_VARARGS is not set", (methodInfo.getAccessFlags() & Flags.ACC_VARARGS) == 0); assertNotNull("Method varargMethodshould be there", methodInfo); assertEquals("2", 2, methodInfo.getAttributeCount()); IClassFileAttribute[] attributes = methodInfo.getAttributes(); diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java index dd7b3eddb68..3b998b269da 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTConverter18Test.java @@ -1591,7 +1591,7 @@ public void test399793a() throws JavaModelException { assertTrue(lambdaExpression.parameters().size() == 1); IMethodBinding binding = lambdaExpression.resolveMethodBinding(); assertEquals("public int foo(int) ", binding.toString()); - assertEquals("real modifiers", ClassFileConstants.AccPublic, binding.getModifiers()); + assertEquals("real modifiers", Flags.PUBLIC, binding.getModifiers()); VariableDeclaration variableDeclaration = (VariableDeclaration) lambdaExpression.parameters().get(0); assertTrue(variableDeclaration instanceof VariableDeclarationFragment); fragment = (VariableDeclarationFragment)variableDeclaration; @@ -1627,7 +1627,7 @@ public void test399793b() throws JavaModelException { assertEquals("vlambda -> 200", lambdaExpression.toString()); IMethodBinding binding = lambdaExpression.resolveMethodBinding(); assertEquals("public int foo(int) ", binding.toString()); - assertEquals("real modifiers", ClassFileConstants.AccPublic, binding.getModifiers()); + assertEquals("real modifiers", Flags.PUBLIC, binding.getModifiers()); assertTrue(lambdaExpression.parameters().size() == 1); VariableDeclaration variableDeclaration = (VariableDeclaration) lambdaExpression.parameters().get(0); assertTrue(variableDeclaration instanceof VariableDeclarationFragment); @@ -1662,7 +1662,7 @@ public void test399793c() throws JavaModelException { assertEquals("(int[] ia) -> {\n return ia.clone();\n}\n", lambdaExpression.toString()); IMethodBinding binding = lambdaExpression.resolveMethodBinding(); assertEquals("public java.lang.Object foo(int[]) ", binding.toString()); - assertEquals("real modifiers", ClassFileConstants.AccPublic, binding.getModifiers()); + assertEquals("real modifiers", Flags.PUBLIC, binding.getModifiers()); assertTrue(lambdaExpression.parameters().size() == 1); VariableDeclaration variableDeclaration = (VariableDeclaration) lambdaExpression.parameters().get(0); assertTrue(variableDeclaration instanceof SingleVariableDeclaration); @@ -1705,7 +1705,7 @@ public void test399793d() throws JavaModelException { assertEquals("() -> {\n System.out.println(this);\n I j=() -> {\n System.out.println(this);\n I k=() -> {\n System.out.println(this);\n }\n;\n }\n;\n}\n", lambdaExpression.toString()); IMethodBinding binding = lambdaExpression.resolveMethodBinding(); assertEquals("public void doit() ", binding.toString()); - assertEquals("real modifiers", ClassFileConstants.AccPublic, binding.getModifiers()); + assertEquals("real modifiers", Flags.PUBLIC, binding.getModifiers()); assertTrue(lambdaExpression.parameters().size() == 0); } @@ -1959,7 +1959,7 @@ public void test399793e() throws JavaModelException { assertEquals("() -> () -> 10", lambdaExpression.toString()); IMethodBinding binding = lambdaExpression.resolveMethodBinding(); assertEquals("public test399793.J foo() ", binding.toString()); - assertEquals("real modifiers", ClassFileConstants.AccPublic, binding.getModifiers()); + assertEquals("real modifiers", Flags.PUBLIC, binding.getModifiers()); assertTrue(lambdaExpression.parameters().size() == 0); } diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java index a71709c3e36..f4f108102ec 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateMethodSourceExamplesTests.java @@ -68,7 +68,7 @@ public void testCreateMethodWithAbstractModifier() { IDOMMethod method= this.domFactory.createMethod(); method.setName("foo"); - method.setFlags(ClassFileConstants.AccPublic| ClassFileConstants.AccAbstract); + method.setFlags(Flags.PUBLIC| Flags.ABSTRACT); assertSourceEquals( "source code incorrect", "public abstract void foo() {\n" + @@ -102,7 +102,7 @@ public void testCreateMethodWithModifiers() { IDOMMethod method= this.domFactory.createMethod(); method.setName("foo"); - method.setFlags(ClassFileConstants.AccPublic| ClassFileConstants.AccStatic); + method.setFlags(Flags.PUBLIC| Flags.STATIC); assertSourceEquals( "source code incorrect", "public static void foo() {\n" + @@ -117,7 +117,7 @@ public void testCreateMethodWithModifiersAndExceptions() { IDOMMethod method= this.domFactory.createMethod(); method.setName("foo"); - method.setFlags(ClassFileConstants.AccPrivate); + method.setFlags(Flags.PRIVATE); method.setExceptions(new String[] {"java.lang.IllegalArgumentException", "java.io.FileNotFoundExcpetion"}); diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java index 12629f8050a..f9b2e6486ac 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/CreateTypeSourceExamplesTests.java @@ -107,7 +107,7 @@ public void testCreateClassWithImplements4() { public void testCreateClassWithModifiers() { IDOMType type= this.domFactory.createType(); type.setName("Foo"); - type.setFlags(ClassFileConstants.AccPublic | ClassFileConstants.AccFinal); + type.setFlags(Flags.PUBLIC | Flags.FINAL); assertSourceEquals( "source code incorrect", "public final class Foo {\n" + diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java index fc457e884ff..a4e5fc23cee 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/SnippetCompletionTests.java @@ -64,7 +64,7 @@ public void testCodeSnippetAssistForClassFile() throws JavaModelException { char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; type.codeComplete(snippet.toCharArray(), -1, snippet.length()-2, typeNames, names, modifiers, false, requestor); @@ -90,7 +90,7 @@ public void testCodeSnippetAssistForCompilationUnit() throws JavaModelException char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; String insertAftrer = "Victory{}"; String s = cu.getSource(); @@ -123,7 +123,7 @@ public void testCodeSnippetAssistForClassFileWithSource() throws JavaModelExcept char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; String insertAftrer = "Victory{}"; String s = cf.getSource(); @@ -157,7 +157,7 @@ public void testCodeSnippetAssistForCompilationUnitWithoutSource() throws JavaMo char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; int insertion = -1; @@ -186,7 +186,7 @@ public void testCodeSnippetAssistForClassFileInInnerClass() throws JavaModelExce char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; String insertAftrer = "Victory{}"; String s = cf.getSource(); @@ -220,7 +220,7 @@ public void testCodeSnippetAssistForClassFileInInterface() throws JavaModelExcep char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; type.codeComplete(snippet.toCharArray(), -1, snippet.length()-2, typeNames, names, modifiers, false, requestor); @@ -248,7 +248,7 @@ public void testCodeSnippetAssistForClassFileInInterface2() throws JavaModelExce char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; type.codeComplete(snippet.toCharArray(), -1, snippet.length()-2, typeNames, names, modifiers, false, requestor); @@ -296,7 +296,7 @@ public void testCodeSnippetAssistInsideNumber() throws JavaModelException { char[][] typeNames = {"SuperClass".toCharArray(), "int".toCharArray()}; char[][] names = {"varsc".toCharArray(), "var".toCharArray()}; - int[] modifiers = {ClassFileConstants.AccDefault, ClassFileConstants.AccFinal}; + int[] modifiers = {0, Flags.FINAL}; type.codeComplete(snippet.toCharArray(), -1, snippet.length()-2, typeNames, names, modifiers, false, requestor); diff --git a/org.eclipse.jdt.core/.classpath b/org.eclipse.jdt.core/.classpath index 490de24cd73..d1547eb88ae 100644 --- a/org.eclipse.jdt.core/.classpath +++ b/org.eclipse.jdt.core/.classpath @@ -3,7 +3,7 @@ - + diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java index 72a26cc2fce..34498b1f1ad 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/CompletionEngine.java @@ -617,7 +617,7 @@ private static boolean hasStaticMemberTypes(ReferenceBinding typeBinding, Source continue next; } - if ((memberType.modifiers & ClassFileConstants.AccStatic) != 0) { + if ((memberType.modifiers & com.sun.tools.javac.code.Flags.STATIC) != 0) { return true; } } @@ -943,13 +943,13 @@ public void acceptConstructor( if ((this.foundConstructorsCount % (CHECK_CANCEL_FREQUENCY)) == 0) checkCancel(); this.foundConstructorsCount++; - if ((typeModifiers & ClassFileConstants.AccEnum) != 0) return; + if ((typeModifiers & com.sun.tools.javac.code.Flags.ENUM) != 0) return; if (this.options.checkDeprecation && (typeModifiers & ClassFileConstants.AccDeprecated) != 0) return; if (this.options.checkVisibility) { - if((typeModifiers & ClassFileConstants.AccPublic) == 0) { - if((typeModifiers & ClassFileConstants.AccPrivate) != 0) return; + if((typeModifiers & com.sun.tools.javac.code.Flags.PUBLIC) == 0) { + if((typeModifiers & com.sun.tools.javac.code.Flags.PRIVATE) != 0) return; if (this.currentPackageName == null) { initializePackageCache(); @@ -1049,8 +1049,8 @@ private void acceptConstructors(Scope scope) { boolean proposeConstructor = true; if (this.options.checkVisibility) { - if((modifiers & ClassFileConstants.AccPublic) == 0) { - if((modifiers & ClassFileConstants.AccPrivate) != 0) { + if((modifiers & com.sun.tools.javac.code.Flags.PUBLIC) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.PRIVATE) != 0) { if (!proposeType) continue next; proposeConstructor = false; } else { @@ -1060,8 +1060,8 @@ private void acceptConstructors(Scope scope) { if(!CharOperation.equals(packageName, this.currentPackageName)) { - if((typeModifiers & ClassFileConstants.AccAbstract) == 0 || - (modifiers & ClassFileConstants.AccProtected) == 0) { + if((typeModifiers & com.sun.tools.javac.code.Flags.ABSTRACT) == 0 || + (modifiers & com.sun.tools.javac.code.Flags.PROTECTED) == 0) { if (!proposeType) continue next; proposeConstructor = false; } @@ -1173,7 +1173,7 @@ private void acceptConstructors(Scope scope) { } if(CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName, importFlatName)) { if(importBinding.isStatic()) { - if((typeModifiers & ClassFileConstants.AccStatic) != 0) { + if((typeModifiers & com.sun.tools.javac.code.Flags.STATIC) != 0) { onDemandFound.put( simpleTypeName, acceptedConstructor); @@ -1199,7 +1199,7 @@ private void acceptConstructors(Scope scope) { } if(CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName, importFlatName)) { if(importBinding.isStatic()) { - if((typeModifiers & ClassFileConstants.AccStatic) != 0) { + if((typeModifiers & com.sun.tools.javac.code.Flags.STATIC) != 0) { foundConstructor.mustBeQualified = true; break done; } @@ -1256,7 +1256,7 @@ private void acceptConstructors(Scope scope) { } if(CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName, importFlatName)) { if(importBinding.isStatic()) { - if((value.modifiers & ClassFileConstants.AccStatic) != 0) { + if((value.modifiers & com.sun.tools.javac.code.Flags.STATIC) != 0) { value.mustBeQualified = true; break done; } @@ -1456,12 +1456,12 @@ public void acceptType( this.foundTypesCount++; if (this.options.checkDeprecation && (modifiers & ClassFileConstants.AccDeprecated) != 0) return; - if (this.assistNodeIsExtendedType && (modifiers & ClassFileConstants.AccFinal) != 0) return; + if (this.assistNodeIsExtendedType && (modifiers & com.sun.tools.javac.code.Flags.FINAL) != 0) return; if (this.assistNodeIsExtendedType && (modifiers & ExtraCompilerModifiers.AccRecord) != 0) return; if (this.options.checkVisibility) { - if((modifiers & ClassFileConstants.AccPublic) == 0) { - if((modifiers & ClassFileConstants.AccPrivate) != 0) return; + if((modifiers & com.sun.tools.javac.code.Flags.PUBLIC) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.PRIVATE) != 0) return; if (this.moduleDeclaration == null) { char[] currentPackage = CharOperation.concatWith(this.unitScope.fPackage.compoundName, '.'); if(!CharOperation.equals(packageName, currentPackage)) return; @@ -1546,7 +1546,7 @@ private void acceptTypes(Scope scope) { if(this.resolvingStaticImports) { if(enclosingTypeNames == null || enclosingTypeNames.length == 0) { completionName = CharOperation.concat(completionName, new char[] { '.' }); - } else if ((modifiers & ClassFileConstants.AccStatic) == 0) { + } else if ((modifiers & com.sun.tools.javac.code.Flags.STATIC) == 0) { continue next; } else { completionName = appendUnlessNextToken(completionName, new char[] { ';' }, TerminalTokens.TokenNameSEMICOLON); @@ -1623,7 +1623,7 @@ private void acceptTypes(Scope scope) { } if(CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName, importFlatName)) { if(importBinding.isStatic()) { - if((modifiers & ClassFileConstants.AccStatic) != 0) { + if((modifiers & com.sun.tools.javac.code.Flags.STATIC) != 0) { acceptedType.qualifiedTypeName = typeName; acceptedType.fullyQualifiedName = fullyQualifiedName; onDemandFound.put( @@ -1662,7 +1662,7 @@ private void acceptTypes(Scope scope) { } if(CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName, importFlatName)) { if(importBinding.isStatic()) { - if((modifiers & ClassFileConstants.AccStatic) != 0) { + if((modifiers & com.sun.tools.javac.code.Flags.STATIC) != 0) { foundType.mustBeQualified = true; break done; } @@ -1907,13 +1907,13 @@ private void buildTokenLocationContext(InternalCompletionContext context, Scope if (astNode instanceof CompletionOnFieldType) { CompletionOnFieldType field = (CompletionOnFieldType) astNode; if (!field.isLocalVariable && - field.modifiers == ClassFileConstants.AccDefault && + field.modifiers == 0 && (field.annotations == null || field.annotations.length == 0)) { context.setTokenLocation(CompletionContext.TL_MEMBER_START); } } else if (astNode instanceof CompletionOnMethodReturnType) { CompletionOnMethodReturnType method = (CompletionOnMethodReturnType) astNode; - if (method.modifiers == ClassFileConstants.AccDefault && + if (method.modifiers == 0 && (method.annotations == null || method.annotations.length == 0)) { context.setTokenLocation(CompletionContext.TL_MEMBER_START); } @@ -2717,9 +2717,9 @@ private void completionOnFieldName(ASTNode astNode, Scope scope) { int kind = - (field.modifiers & ClassFileConstants.AccStatic) == 0 ? + (field.modifiers & com.sun.tools.javac.code.Flags.STATIC) == 0 ? InternalNamingConventions.VK_INSTANCE_FIELD : - (field.modifiers & ClassFileConstants.AccFinal) == 0 ? + (field.modifiers & com.sun.tools.javac.code.Flags.FINAL) == 0 ? InternalNamingConventions.VK_STATIC_FIELD : InternalNamingConventions.VK_STATIC_FINAL_FIELD; @@ -2753,7 +2753,7 @@ private void completionOnFieldType(ASTNode astNode, Scope scope) { findKeywordsForMember(this.completionToken, field.modifiers, astNode); } - if (!field.isLocalVariable && field.modifiers == ClassFileConstants.AccDefault) { + if (!field.isLocalVariable && field.modifiers == 0) { SourceTypeBinding enclosingType = scope.enclosingSourceType(); if (!enclosingType.isAnnotationType()) { if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) { @@ -3513,9 +3513,9 @@ private void completionOnMethodName(ASTNode astNode, Scope scope) { int kind = - (method.modifiers & ClassFileConstants.AccStatic) == 0 ? + (method.modifiers & com.sun.tools.javac.code.Flags.STATIC) == 0 ? InternalNamingConventions.VK_INSTANCE_FIELD : - (method.modifiers & ClassFileConstants.AccFinal) == 0 ? + (method.modifiers & com.sun.tools.javac.code.Flags.FINAL) == 0 ? InternalNamingConventions.VK_STATIC_FIELD : InternalNamingConventions.VK_STATIC_FINAL_FIELD; @@ -3533,7 +3533,7 @@ private void completionOnMethodReturnType(ASTNode astNode, Scope scope) { findKeywordsForMember(this.completionToken, method.modifiers, null); } - if (method.modifiers == ClassFileConstants.AccDefault) { + if (method.modifiers == 0) { SourceTypeBinding enclosingType = scope.enclosingSourceType(); if (!enclosingType.isAnnotationType()) { if (!this.requestor.isIgnored(CompletionProposal.METHOD_DECLARATION)) { @@ -4113,7 +4113,7 @@ private void completionOnSingleTypeReference(ASTNode astNode, ASTNode astNodePar else if ( astNodeParent instanceof InstanceOfExpression) { // propose final keyword if (!this.requestor.isIgnored(CompletionProposal.KEYWORD)) { - findKeywordsForMember(this.completionToken, (~ClassFileConstants.AccFinal & 0xFF), astNode); + findKeywordsForMember(this.completionToken, (~com.sun.tools.javac.code.Flags.FINAL & 0xFF), astNode); } } @@ -5293,8 +5293,8 @@ private char[] createImportCharArray(char[] importedElement, boolean isStatic, b private void createMethod(MethodBinding method, char[][] parameterPackageNames, char[][] parameterTypeNames, char[][] parameterNames, Scope scope, StringBuffer completion) { //// Modifiers // flush uninteresting modifiers - int insertedModifiers = method.modifiers & ~(ClassFileConstants.AccNative | ClassFileConstants.AccAbstract); - if(insertedModifiers != ClassFileConstants.AccDefault){ + int insertedModifiers = method.modifiers & ~(com.sun.tools.javac.code.Flags.NATIVE | com.sun.tools.javac.code.Flags.ABSTRACT); + if(insertedModifiers != 0){ ASTNode.printModifiers(insertedModifiers, completion); } @@ -9194,12 +9194,12 @@ private void findKeywordsForMember(char[] token, int modifiers, ASTNode astNode) int count = 0; // visibility - if((modifiers & ClassFileConstants.AccPrivate) == 0 - && (modifiers & ClassFileConstants.AccProtected) == 0 - && (modifiers & ClassFileConstants.AccPublic) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.PRIVATE) == 0 + && (modifiers & com.sun.tools.javac.code.Flags.PROTECTED) == 0 + && (modifiers & com.sun.tools.javac.code.Flags.PUBLIC) == 0) { keywords[count++] = Keywords.PROTECTED; keywords[count++] = Keywords.PUBLIC; - if((modifiers & ClassFileConstants.AccAbstract) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.ABSTRACT) == 0) { keywords[count++] = Keywords.PRIVATE; } } @@ -9211,63 +9211,63 @@ private void findKeywordsForMember(char[] token, int modifiers, ASTNode astNode) if (declaringClass != null && declaringClass.isInterface() && !declaringClass.isAnnotationType()) keywords[count++] = Keywords.DEFAULT; } - if((modifiers & ClassFileConstants.AccAbstract) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.ABSTRACT) == 0) { // abtract - if((modifiers & ~(ExtraCompilerModifiers.AccVisibilityMASK | ClassFileConstants.AccStatic)) == 0) { + if((modifiers & ~(ExtraCompilerModifiers.AccVisibilityMASK | com.sun.tools.javac.code.Flags.STATIC)) == 0) { keywords[count++] = Keywords.ABSTRACT; } // final - if((modifiers & ClassFileConstants.AccFinal) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.FINAL) == 0) { keywords[count++] = Keywords.FINAL; } // static - if((modifiers & ClassFileConstants.AccStatic) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.STATIC) == 0) { keywords[count++] = Keywords.STATIC; } boolean canBeField = true; boolean canBeMethod = true; boolean canBeType = true; - if((modifiers & ClassFileConstants.AccNative) != 0 - || (modifiers & ClassFileConstants.AccStrictfp) != 0 - || (modifiers & ClassFileConstants.AccSynchronized) != 0) { + if((modifiers & com.sun.tools.javac.code.Flags.NATIVE) != 0 + || (modifiers & com.sun.tools.javac.code.Flags.STRICTFP) != 0 + || (modifiers & com.sun.tools.javac.code.Flags.SYNCHRONIZED) != 0) { canBeField = false; canBeType = false; } - if((modifiers & ClassFileConstants.AccTransient) != 0 - || (modifiers & ClassFileConstants.AccVolatile) != 0) { + if((modifiers & com.sun.tools.javac.code.Flags.TRANSIENT) != 0 + || (modifiers & com.sun.tools.javac.code.Flags.VOLATILE) != 0) { canBeMethod = false; canBeType = false; } if(canBeField) { // transient - if((modifiers & ClassFileConstants.AccTransient) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.TRANSIENT) == 0) { keywords[count++] = Keywords.TRANSIENT; } // volatile - if((modifiers & ClassFileConstants.AccVolatile) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.VOLATILE) == 0) { keywords[count++] = Keywords.VOLATILE; } } if(canBeMethod) { // native - if((modifiers & ClassFileConstants.AccNative) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.NATIVE) == 0) { keywords[count++] = Keywords.NATIVE; } // strictfp - if((modifiers & ClassFileConstants.AccStrictfp) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.STRICTFP) == 0) { keywords[count++] = Keywords.STRICTFP; } // synchronized - if((modifiers & ClassFileConstants.AccSynchronized) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.SYNCHRONIZED) == 0) { keywords[count++] = Keywords.SYNCHRONIZED; } } @@ -9276,7 +9276,7 @@ private void findKeywordsForMember(char[] token, int modifiers, ASTNode astNode) keywords[count++] = Keywords.CLASS; keywords[count++] = Keywords.INTERFACE; - if((modifiers & ClassFileConstants.AccFinal) == 0) { + if((modifiers & com.sun.tools.javac.code.Flags.FINAL) == 0) { keywords[count++] = Keywords.ENUM; } } @@ -13653,7 +13653,7 @@ private ImportBinding[] getFavoriteReferenceBindings(Scope scope) { compoundName, new long[compoundName.length], onDemand, - isStatic ? ClassFileConstants.AccStatic : ClassFileConstants.AccDefault); + isStatic ? com.sun.tools.javac.code.Flags.STATIC : 0); Binding importBinding = this.unitScope.findImport(compoundName, isStatic, onDemand); @@ -14211,18 +14211,18 @@ private void proposeConstructor( } boolean isInterface = false; - int kind = typeModifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation); + int kind = typeModifiers & (com.sun.tools.javac.code.Flags.INTERFACE | com.sun.tools.javac.code.Flags.ENUM | com.sun.tools.javac.code.Flags.ANNOTATION); switch (kind) { - case ClassFileConstants.AccAnnotation: - case ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface: + case com.sun.tools.javac.code.Flags.ANNOTATION: + case com.sun.tools.javac.code.Flags.ANNOTATION | com.sun.tools.javac.code.Flags.INTERFACE: relevance += computeRelevanceForAnnotation(); relevance += computeRelevanceForInterface(); isInterface = true; break; - case ClassFileConstants.AccEnum: + case com.sun.tools.javac.code.Flags.ENUM: relevance += computeRelevanceForEnum(); break; - case ClassFileConstants.AccInterface: + case com.sun.tools.javac.code.Flags.INTERFACE: relevance += computeRelevanceForInterface(); isInterface = true; break; @@ -14263,7 +14263,7 @@ private void proposeConstructor( flags |= Flags.AccDeprecated; } - if (isInterface || (typeModifiers & ClassFileConstants.AccAbstract) != 0) { + if (isInterface || (typeModifiers & com.sun.tools.javac.code.Flags.ABSTRACT) != 0) { this.noProposal = false; if(!isIgnored(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, CompletionProposal.TYPE_REF)) { InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, this.actualCompletionPosition); @@ -14320,7 +14320,7 @@ private void proposeConstructor( break; case 0: // constructor with no parameter - if ((typeModifiers & ClassFileConstants.AccAbstract) != 0) { + if ((typeModifiers & com.sun.tools.javac.code.Flags.ABSTRACT) != 0) { this.noProposal = false; if(!isIgnored(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, CompletionProposal.TYPE_REF)) { InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, this.actualCompletionPosition); @@ -14389,7 +14389,7 @@ private void proposeConstructor( parameterNames = null; } - if ((typeModifiers & ClassFileConstants.AccAbstract) != 0) { + if ((typeModifiers & com.sun.tools.javac.code.Flags.ABSTRACT) != 0) { this.noProposal = false; if(!isIgnored(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, CompletionProposal.TYPE_REF)) { InternalCompletionProposal proposal = createProposal(CompletionProposal.ANONYMOUS_CLASS_CONSTRUCTOR_INVOCATION, this.actualCompletionPosition); @@ -14513,7 +14513,7 @@ private void proposeType( return; } TypeBinding guessedType = null; - if ((modifiers & ClassFileConstants.AccAnnotation) != 0 && + if ((modifiers & com.sun.tools.javac.code.Flags.ANNOTATION) != 0 && this.assistNodeIsAnnotation && (this.targetedElement & TagBits.AnnotationTargetMASK) != 0) { char[][] cn = CharOperation.splitOn('.', fullyQualifiedName); @@ -14548,18 +14548,18 @@ private void proposeType( relevance += computeRelevanceForExpectingType(packageName, simpleTypeName); relevance += computeRelevanceForQualification(isQualified); - int kind = modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation); + int kind = modifiers & (com.sun.tools.javac.code.Flags.INTERFACE | com.sun.tools.javac.code.Flags.ENUM | com.sun.tools.javac.code.Flags.ANNOTATION); switch (kind) { - case ClassFileConstants.AccAnnotation: - case ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface: + case com.sun.tools.javac.code.Flags.ANNOTATION: + case com.sun.tools.javac.code.Flags.ANNOTATION | com.sun.tools.javac.code.Flags.INTERFACE: relevance += computeRelevanceForAnnotation(); if (guessedType != null) relevance += computeRelevanceForAnnotationTarget(guessedType); relevance += computeRelevanceForInterface(); break; - case ClassFileConstants.AccEnum: + case com.sun.tools.javac.code.Flags.ENUM: relevance += computeRelevanceForEnum(); break; - case ClassFileConstants.AccInterface: + case com.sun.tools.javac.code.Flags.INTERFACE: relevance += computeRelevanceForInterface(); break; default: diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java index 64b73515c0e..03b53086a46 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java @@ -73,7 +73,6 @@ import org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeParameter; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException; import org.eclipse.jdt.internal.compiler.env.AccessRestriction; @@ -131,6 +130,8 @@ import org.eclipse.jdt.internal.core.util.ASTNodeFinder; import org.eclipse.jdt.internal.core.util.HashSetOfCharArrayArray; +import com.sun.tools.javac.code.Flags; + /** * The selection engine is intended to infer the nature of a selected name in some * source code. This name can be qualified. @@ -392,10 +393,10 @@ public void acceptType(char[] packageName, char[] simpleTypeName, char[][] enclo CharOperation.concatWith(enclosingTypeNames, '.'); if(mustQualifyType(packageName, simpleTypeName, flatEnclosingTypeNames, modifiers)) { int length = 0; - int kind = modifiers & (ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation); + int kind = modifiers & (Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION); switch (kind) { - case ClassFileConstants.AccAnnotation: - case ClassFileConstants.AccAnnotation | ClassFileConstants.AccInterface: + case Flags.ANNOTATION: + case Flags.ANNOTATION | Flags.INTERFACE: char[][] acceptedAnnotation = new char[2][]; acceptedAnnotation[0] = packageName; acceptedAnnotation[1] = typeName; @@ -414,7 +415,7 @@ public void acceptType(char[] packageName, char[] simpleTypeName, char[][] enclo this.acceptedAnnotationsModifiers[this.acceptedAnnotationsCount] = modifiers; this.acceptedAnnotations[this.acceptedAnnotationsCount++] = acceptedAnnotation; break; - case ClassFileConstants.AccEnum: + case Flags.ENUM: char[][] acceptedEnum = new char[2][]; acceptedEnum[0] = packageName; acceptedEnum[1] = typeName; @@ -433,7 +434,7 @@ public void acceptType(char[] packageName, char[] simpleTypeName, char[][] enclo this.acceptedEnumsModifiers[this.acceptedEnumsCount] = modifiers; this.acceptedEnums[this.acceptedEnumsCount++] = acceptedEnum; break; - case ClassFileConstants.AccInterface: + case Flags.INTERFACE: char[][] acceptedInterface= new char[2][]; acceptedInterface[0] = packageName; acceptedInterface[1] = typeName; diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java index 0153fd31550..f603ff06bf0 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnArgumentName.java @@ -18,7 +18,6 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.Argument; import org.eclipse.jdt.internal.compiler.ast.TypeReference; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.MethodScope; import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; @@ -37,7 +36,7 @@ public CompletionOnArgumentName(char[] name , long posNom , TypeReference tr , i } /** For type elided lambda argument */ public CompletionOnArgumentName(Argument typeElidedArgument, long posNom) { - super(typeElidedArgument.name, posNom, null, ClassFileConstants.AccDefault, true); + super(typeElidedArgument.name, posNom, null, 0, true); } @Override diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java index 4a983baab43..9490c7db9ba 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnKeyword2.java @@ -14,13 +14,12 @@ package org.eclipse.jdt.internal.codeassist.complete; import org.eclipse.jdt.internal.compiler.ast.ImportReference; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; public class CompletionOnKeyword2 extends ImportReference implements CompletionOnKeyword { private char[] token; private char[][] possibleKeywords; public CompletionOnKeyword2(char[] token, long pos, char[][] possibleKeywords) { - super(new char[][]{token}, new long[]{pos}, false, ClassFileConstants.AccDefault); + super(new char[][]{token}, new long[]{pos}, false, 0); this.token = token; this.possibleKeywords = possibleKeywords; } diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java index a6e0fc58df8..5dbd0034600 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionOnPackageReference.java @@ -36,11 +36,10 @@ */ import org.eclipse.jdt.internal.compiler.ast.*; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; public class CompletionOnPackageReference extends ImportReference implements CompletionNode { public CompletionOnPackageReference(char[][] tokens , long[] positions) { - super(tokens, positions, false, ClassFileConstants.AccDefault); + super(tokens, positions, false, 0); } @Override public StringBuffer print(int indent, StringBuffer output, boolean withOnDemand) { diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java index 676a6d318df..17daf00450b 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionParser.java @@ -135,6 +135,8 @@ import org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + public class CompletionParser extends AssistParser { // OWNER protected static final int COMPLETION_PARSER = 1024; @@ -1658,20 +1660,20 @@ private boolean checkKeywordAndRestrictedIdentifiers() { int count = 0; if(unit.typeCount == 0 && (!this.compilationUnit.isPackageInfo() || this.compilationUnit.currentPackage != null) - && this.lastModifiers == ClassFileConstants.AccDefault) { + && this.lastModifiers == 0) { keywordsAndRestrictedIndentifiers[count++] = Keywords.IMPORT; } if(unit.typeCount == 0 && unit.importCount == 0 - && this.lastModifiers == ClassFileConstants.AccDefault + && this.lastModifiers == 0 && this.compilationUnit.currentPackage == null) { keywordsAndRestrictedIndentifiers[count++] = Keywords.PACKAGE; } if (!this.compilationUnit.isPackageInfo()) { - if((this.lastModifiers & ClassFileConstants.AccPublic) == 0) { + if((this.lastModifiers & Flags.PUBLIC) == 0) { boolean hasNoPublicType = true; for (int i = 0; i < unit.typeCount; i++) { - if((unit.types[i].typeDeclaration.modifiers & ClassFileConstants.AccPublic) != 0) { + if((unit.types[i].typeDeclaration.modifiers & Flags.PUBLIC) != 0) { hasNoPublicType = false; break; } @@ -1680,12 +1682,12 @@ private boolean checkKeywordAndRestrictedIdentifiers() { keywordsAndRestrictedIndentifiers[count++] = Keywords.PUBLIC; } } - if((this.lastModifiers & ClassFileConstants.AccAbstract) == 0 - && (this.lastModifiers & ClassFileConstants.AccFinal) == 0) { + if((this.lastModifiers & Flags.ABSTRACT) == 0 + && (this.lastModifiers & Flags.FINAL) == 0) { keywordsAndRestrictedIndentifiers[count++] = Keywords.ABSTRACT; } - if((this.lastModifiers & ClassFileConstants.AccAbstract) == 0 - && (this.lastModifiers & ClassFileConstants.AccFinal) == 0) { + if((this.lastModifiers & Flags.ABSTRACT) == 0 + && (this.lastModifiers & Flags.FINAL) == 0) { keywordsAndRestrictedIndentifiers[count++] = Keywords.FINAL; } @@ -1693,7 +1695,7 @@ private boolean checkKeywordAndRestrictedIdentifiers() { if (this.options.complianceLevel >= ClassFileConstants.JDK1_5) { keywordsAndRestrictedIndentifiers[count++] = Keywords.ENUM; } - if((this.lastModifiers & ClassFileConstants.AccFinal) == 0) { + if((this.lastModifiers & Flags.FINAL) == 0) { keywordsAndRestrictedIndentifiers[count++] = Keywords.INTERFACE; } if (JavaFeature.RECORDS.isSupported(this.options)) { @@ -2686,7 +2688,7 @@ protected void consumeCompilationUnit() { this.compilationUnit.types = new TypeDeclaration[1]; TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); declaration.name = FAKE_TYPE_NAME; - declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; + declaration.modifiers = 0 | Flags.INTERFACE; this.compilationUnit.types[0] = declaration; } } @@ -4832,7 +4834,7 @@ protected void consumeTypeHeaderNameWithTypeParameters() { super.consumeTypeHeaderNameWithTypeParameters(); TypeDeclaration typeDecl = (TypeDeclaration)this.astStack[this.astPtr]; - classHeaderExtendsOrImplements((typeDecl.modifiers & ClassFileConstants.AccInterface) != 0, false); + classHeaderExtendsOrImplements((typeDecl.modifiers & Flags.INTERFACE) != 0, false); } @Override protected void consumeTypeImportOnDemandDeclarationName() { @@ -5225,7 +5227,7 @@ && topKnownElementInfo(COMPLETION_OR_ASSIST_PARSER) == SWITCH) { boolean computeKeywords(int kind, List keywords) { boolean canBeExplicitConstructorCall = false; - if((this.lastModifiers & ClassFileConstants.AccStatic) == 0) { + if((this.lastModifiers & Flags.STATIC) == 0) { keywords.add(Keywords.SUPER); keywords.add(Keywords.THIS); } diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java index 2e4d00e0d90..45e65177871 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/AssistParser.java @@ -57,7 +57,6 @@ import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypePattern; import org.eclipse.jdt.internal.compiler.ast.TypeReference; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; @@ -74,12 +73,14 @@ import org.eclipse.jdt.internal.compiler.parser.RecoveredUnit; import org.eclipse.jdt.internal.compiler.problem.AbortCompilation; import org.eclipse.jdt.internal.compiler.problem.ProblemReporter; + +import com.sun.tools.javac.code.Flags; public abstract class AssistParser extends Parser { public ASTNode assistNode; public boolean isOrphanCompletionNode; private boolean resumedAfterRepair = false; // last modifiers info - protected int lastModifiers = ClassFileConstants.AccDefault; + protected int lastModifiers = 0; protected int lastModifiersStart = -1; /* recovery */ int[] blockStarts = new int[30]; @@ -1136,7 +1137,7 @@ protected void consumeSingleStaticImportDeclarationName() { length); /* build specific assist node on import statement */ - ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccStatic); + ImportReference reference = createAssistImportReference(subset, positions, Flags.STATIC); this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; @@ -1289,7 +1290,7 @@ protected void consumeSingleTypeImportDeclarationName() { length); /* build specific assist node on import statement */ - ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccDefault); + ImportReference reference = createAssistImportReference(subset, positions, 0); this.assistNode = reference; this.lastCheckPoint = reference.sourceEnd + 1; @@ -1341,7 +1342,7 @@ protected void consumeStaticImportOnDemandDeclarationName() { length); /* build specific assist node on import statement */ - ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccStatic); + ImportReference reference = createAssistImportReference(subset, positions, Flags.STATIC); reference.bits |= ASTNode.OnDemand; // star end position reference.trailingStarPosition = this.intStack[this.intPtr--]; @@ -1477,7 +1478,7 @@ protected void consumeTypeImportOnDemandDeclarationName() { length); /* build specific assist node on import statement */ - ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccDefault); + ImportReference reference = createAssistImportReference(subset, positions, 0); reference.bits |= ASTNode.OnDemand; // star end position reference.trailingStarPosition = this.intStack[this.intPtr--]; @@ -2490,7 +2491,7 @@ protected int resumeAfterRecovery() { this.valueLambdaNestDepth = -1; - this.modifiers = ClassFileConstants.AccDefault; + this.modifiers = 0; this.modifiersSourceStart = -1; // if in diet mode, reset the diet counter because we're going to restart outside an initializer. diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java index 02c6c18ad45..42ba623596b 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/impl/Engine.java @@ -19,7 +19,6 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.*; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.*; import org.eclipse.jdt.internal.compiler.ast.*; @@ -33,6 +32,8 @@ import org.eclipse.jdt.internal.core.SourceType; import org.eclipse.jdt.internal.core.SourceTypeElementInfo; +import com.sun.tools.javac.code.Flags; + public abstract class Engine implements ITypeRequestor { public LookupEnvironment lookupEnvironment; @@ -247,7 +248,7 @@ protected boolean mustQualifyType( } if(CharOperation.equals(fullyQualifiedEnclosingTypeName, importFlatName)) { if(importBinding.isStatic()) { - isFound = (modifiers & ClassFileConstants.AccStatic) != 0; + isFound = (modifiers & Flags.STATIC) != 0; } else { isFound = true; } @@ -257,7 +258,7 @@ protected boolean mustQualifyType( if(enclosingTypeNames == null || enclosingTypeNames.length == 0) { if(CharOperation.equals(packageName, importFlatName)) { if(importBinding.isStatic()) { - isFound = (modifiers & ClassFileConstants.AccStatic) != 0; + isFound = (modifiers & Flags.STATIC) != 0; } else { isFound = true; } diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java index ef874f0f3a5..e154eb9649c 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionOnPackageReference.java @@ -33,11 +33,10 @@ */ import org.eclipse.jdt.internal.compiler.ast.ImportReference; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; public class SelectionOnPackageReference extends ImportReference { public SelectionOnPackageReference(char[][] tokens , long[] positions) { - super(tokens, positions, false, ClassFileConstants.AccDefault); + super(tokens, positions, false, 0); } @Override public StringBuffer print(int tab, StringBuffer output, boolean withOnDemand) { diff --git a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java index e12dbe6fcfe..b48eae3c5d3 100644 --- a/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java +++ b/org.eclipse.jdt.core/codeassist/org/eclipse/jdt/internal/codeassist/select/SelectionParser.java @@ -1280,7 +1280,7 @@ protected void consumeStaticImportOnDemandDeclarationName() { length); /* build specific assist node on import statement */ - ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccStatic); + ImportReference reference = createAssistImportReference(subset, positions, com.sun.tools.javac.code.Flags.STATIC); reference.bits |= ASTNode.OnDemand; // star end position reference.trailingStarPosition = this.intStack[this.intPtr--]; @@ -1383,7 +1383,7 @@ protected void consumeTypeImportOnDemandDeclarationName() { length); /* build specific assist node on import statement */ - ImportReference reference = createAssistImportReference(subset, positions, ClassFileConstants.AccDefault); + ImportReference reference = createAssistImportReference(subset, positions, 0); reference.bits |= ASTNode.OnDemand; // star end position reference.trailingStarPosition = this.intStack[this.intPtr--]; @@ -1757,7 +1757,7 @@ protected Argument typeElidedArgument() { identifierName, namePositions, null, // elided type - ClassFileConstants.AccDefault, + 0, true); argument.declarationSourceStart = (int) (namePositions >>> 32); this.assistNode = argument; diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java index a3f17373635..793e7ccd2f8 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTConverter.java @@ -75,6 +75,8 @@ import org.eclipse.jdt.internal.core.dom.util.DOMASTUtil; import org.eclipse.jdt.internal.core.util.Util; +import com.sun.tools.javac.code.Flags; + /** * Internal class for converting internal compiler ASTs into public ASTs. */ @@ -756,10 +758,10 @@ public ASTNode convert(boolean isInterface, org.eclipse.jdt.internal.compiler.as } } if (block != null) { - if ((methodDeclaration.modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccNative)) != 0 + if ((methodDeclaration.modifiers & (Flags.ABSTRACT | Flags.NATIVE)) != 0 || (isInterface && (this.ast.apiLevel < AST.JLS8_INTERNAL || - (methodDeclaration.modifiers & (ClassFileConstants.AccStatic | ExtraCompilerModifiers.AccDefaultMethod | - (this.ast.apiLevel > AST.JLS8_INTERNAL ? ClassFileConstants.AccPrivate : 0))) == 0))) { + (methodDeclaration.modifiers & (Flags.STATIC | ExtraCompilerModifiers.AccDefaultMethod | + (this.ast.apiLevel > AST.JLS8_INTERNAL ? Flags.PRIVATE : 0))) == 0))) { methodDecl.setFlags(methodDecl.getFlags() | ASTNode.MALFORMED); } } @@ -3593,13 +3595,13 @@ public ImportDeclaration convertImport(org.eclipse.jdt.internal.compiler.ast.Imp importDeclaration.setSourceRange(importReference.declarationSourceStart, importReference.declarationEnd - importReference.declarationSourceStart + 1); importDeclaration.setOnDemand(onDemand); int modifiers = importReference.modifiers; - if (modifiers != ClassFileConstants.AccDefault) { + if (modifiers != 0) { switch(this.ast.apiLevel) { case AST.JLS2_INTERNAL : importDeclaration.setFlags(importDeclaration.getFlags() | ASTNode.MALFORMED); break; default : - if (modifiers == ClassFileConstants.AccStatic) { + if (modifiers == Flags.STATIC) { importDeclaration.setStatic(true); } else { importDeclaration.setFlags(importDeclaration.getFlags() | ASTNode.MALFORMED); @@ -6175,7 +6177,7 @@ protected void setModifiers(TypeDeclaration typeDecl, org.eclipse.jdt.internal.c switch(this.ast.apiLevel) { case AST.JLS2_INTERNAL : int modifiers = typeDeclaration.modifiers; - modifiers &= ~ClassFileConstants.AccInterface; // remove AccInterface flags + modifiers &= ~Flags.INTERFACE; // remove AccInterface flags modifiers &= ExtraCompilerModifiers.AccJustFlag; typeDecl.internalSetModifiers(modifiers); if (typeDeclaration.annotations != null) { diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java index 8110b453383..7790e8161d3 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/BindingComparator.java @@ -16,7 +16,6 @@ import java.util.HashSet; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.CaptureBinding; import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; @@ -28,6 +27,8 @@ import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding; +import com.sun.tools.javac.code.Flags; + /** * Internal helper class for comparing bindings. * @@ -221,8 +222,8 @@ static boolean isEqual(org.eclipse.jdt.internal.compiler.lookup.TypeBinding type ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) typeBinding; ParameterizedTypeBinding parameterizedTypeBinding2 = (ParameterizedTypeBinding) typeBinding2; return CharOperation.equals(parameterizedTypeBinding.compoundName, parameterizedTypeBinding2.compoundName) - && (parameterizedTypeBinding.modifiers & (ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) - == (parameterizedTypeBinding2.modifiers & (ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) + && (parameterizedTypeBinding.modifiers & (ExtraCompilerModifiers.AccJustFlag | Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) + == (parameterizedTypeBinding2.modifiers & (ExtraCompilerModifiers.AccJustFlag | Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) && isEqual(parameterizedTypeBinding.arguments, parameterizedTypeBinding2.arguments, visitedTypes) && isEqual(parameterizedTypeBinding.enclosingType(), parameterizedTypeBinding2.enclosingType(), visitedTypes); @@ -281,8 +282,8 @@ && isEqual(typeVariableBinding.superclass(), typeVariableBinding2.superclass(), ReferenceBinding referenceBinding = (ReferenceBinding) typeBinding; ReferenceBinding referenceBinding2 = (ReferenceBinding) typeBinding2; return CharOperation.equals(referenceBinding.compoundName, referenceBinding2.compoundName) - && (referenceBinding.modifiers & (ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) - == (referenceBinding2.modifiers & (ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) + && (referenceBinding.modifiers & (ExtraCompilerModifiers.AccJustFlag | Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) + == (referenceBinding2.modifiers & (ExtraCompilerModifiers.AccJustFlag | Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) && isEqual(referenceBinding.typeVariables(), referenceBinding2.typeVariables(), visitedTypes) && isEqual(referenceBinding.enclosingType(), referenceBinding2.enclosingType(), visitedTypes); @@ -314,8 +315,8 @@ && isEqual(referenceBinding.typeVariables(), referenceBinding2.typeVariables(), return CharOperation.equals(referenceBinding.compoundName, referenceBinding2.compoundName) && (!referenceBinding2.isGenericType()) && (referenceBinding.isRawType() == referenceBinding2.isRawType()) - && ((referenceBinding.modifiers & ~ClassFileConstants.AccSuper) & (ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) - == ((referenceBinding2.modifiers & ~ClassFileConstants.AccSuper) & (ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccInterface | ClassFileConstants.AccEnum | ClassFileConstants.AccAnnotation)) + && ((referenceBinding.modifiers & ~Flags.ACC_SUPER) & (ExtraCompilerModifiers.AccJustFlag | Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) + == ((referenceBinding2.modifiers & ~Flags.ACC_SUPER) & (ExtraCompilerModifiers.AccJustFlag | Flags.INTERFACE | Flags.ENUM | Flags.ANNOTATION)) && isEqual(referenceBinding.enclosingType(), referenceBinding2.enclosingType(), visitedTypes); } } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java index f807e6d3149..a9645c6c8a8 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/MethodBinding.java @@ -19,7 +19,6 @@ import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; import org.eclipse.jdt.internal.compiler.lookup.ParameterizedGenericMethodBinding; @@ -33,6 +32,8 @@ import org.eclipse.jdt.internal.core.JavaElement; import org.eclipse.jdt.internal.core.util.Util; +import com.sun.tools.javac.code.Flags; + /** * Internal implementation of method bindings. */ @@ -551,7 +552,7 @@ public LambdaMethod(DefaultBindingResolver resolver, */ @Override public int getModifiers() { - return super.getModifiers() & ~ClassFileConstants.AccAbstract; + return super.getModifiers() & ~Flags.ABSTRACT; } /** diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java index b11bc305a54..9e2c0d1c325 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/TypeBinding.java @@ -22,7 +22,6 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.StringLiteral; import org.eclipse.jdt.internal.compiler.ast.Wildcard; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; import org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.Binding; @@ -46,6 +45,8 @@ import org.eclipse.jdt.internal.core.JavaElement; import org.eclipse.jdt.internal.core.PackageFragment; +import com.sun.tools.javac.code.Flags; + /** * Internal implementation of type bindings. */ @@ -611,17 +612,17 @@ public int getModifiers() { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; final int accessFlags = referenceBinding.getAccessFlags() & VALID_MODIFIERS; // clear the AccAbstract, AccAnnotation and the AccInterface bits - return accessFlags & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface | ClassFileConstants.AccAnnotation); + return accessFlags & ~(Flags.ABSTRACT | Flags.INTERFACE | Flags.ANNOTATION); } else if (isInterface()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; final int accessFlags = referenceBinding.getAccessFlags() & VALID_MODIFIERS; // clear the AccAbstract and the AccInterface bits - return accessFlags & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccInterface); + return accessFlags & ~(Flags.ABSTRACT | Flags.INTERFACE); } else if (isEnum()) { ReferenceBinding referenceBinding = (ReferenceBinding) this.binding; final int accessFlags = referenceBinding.getAccessFlags() & VALID_MODIFIERS; // clear the AccEnum bits - return accessFlags & ~ClassFileConstants.AccEnum; + return accessFlags & ~Flags.ENUM; } else { return Modifier.NONE; } diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java index 8924a4fde60..7aa7a7a9166 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/VariableBinding.java @@ -21,7 +21,6 @@ import org.eclipse.jdt.core.JavaCore; import org.eclipse.jdt.core.util.IModifierConstants; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.impl.Constant; import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; @@ -33,6 +32,8 @@ import org.eclipse.jdt.internal.core.LocalVariable; import org.eclipse.jdt.internal.core.util.Util; +import com.sun.tools.javac.code.Flags; + /** * Internal implementation of variable bindings. */ @@ -333,7 +334,7 @@ public boolean isDeprecated() { @Override public boolean isEnumConstant() { - return (this.binding.modifiers & ClassFileConstants.AccEnum) != 0; + return (this.binding.modifiers & Flags.ENUM) != 0; } @Override diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java index ca194ed5a15..f8e7ccbf3a7 100644 --- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java +++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetAllocationExpression.java @@ -45,6 +45,7 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeBinding; import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; +import com.sun.tools.javac.code.Flags; import com.sun.tools.javac.jvm.ByteCodes; public class CodeSnippetAllocationExpression extends AllocationExpression implements ProblemReasons, EvaluationConstants { @@ -149,7 +150,7 @@ public TypeBinding resolveType(BlockScope scope) { if (currentType == null) return currentType; do { // isStatic() is answering true for toplevel types - if ((currentType.modifiers & ClassFileConstants.AccStatic) != 0) break checkParameterizedAllocation; + if ((currentType.modifiers & Flags.STATIC) != 0) break checkParameterizedAllocation; if (currentType.isRawType()) break checkParameterizedAllocation; } while ((currentType = currentType.enclosingType())!= null); ParameterizedQualifiedTypeReference qRef = (ParameterizedQualifiedTypeReference) this.type; diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java index 6d404446652..c51a5f07104 100644 --- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java +++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java @@ -34,6 +34,8 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + public class CodeSnippetClassFile extends ClassFile { /** * CodeSnippetClassFile constructor comment. @@ -74,25 +76,25 @@ public CodeSnippetClassFile( int accessFlags = aType.getAccessFlags(); if (!aType.isInterface()) { // class or enum - accessFlags |= ClassFileConstants.AccSuper; + accessFlags |= Flags.ACC_SUPER; } if (aType.isNestedType()) { if (aType.isStatic()) { // clear Acc_Static - accessFlags &= ~ClassFileConstants.AccStatic; + accessFlags &= ~Flags.STATIC; } if (aType.isPrivate()) { // clear Acc_Private and Acc_Public - accessFlags &= ~(ClassFileConstants.AccPrivate | ClassFileConstants.AccPublic); + accessFlags &= ~(Flags.PRIVATE | Flags.PUBLIC); } if (aType.isProtected()) { // clear Acc_Protected and set Acc_Public - accessFlags &= ~ClassFileConstants.AccProtected; - accessFlags |= ClassFileConstants.AccPublic; + accessFlags &= ~Flags.PROTECTED; + accessFlags |= Flags.PUBLIC; } } // clear Acc_Strictfp - accessFlags &= ~ClassFileConstants.AccStrictfp; + accessFlags &= ~Flags.STRICTFP; this.enclosingClassFile = enclosingClassFile; // now we continue to generate the bytes inside the contents array @@ -205,7 +207,7 @@ public static void createProblemType(TypeDeclaration typeDeclaration, Compilatio MethodBinding method = methodDecl.binding; if (method == null) continue; if (abstractMethodsOnly) { - method.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract; + method.modifiers = Flags.PUBLIC | Flags.ABSTRACT; } if (method.isConstructor()) { if (typeBinding.isInterface()) continue; diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java index 1f7426124a7..46ed22e8aae 100644 --- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java +++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetScope.java @@ -18,7 +18,6 @@ package org.eclipse.jdt.internal.eval; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; import org.eclipse.jdt.internal.compiler.lookup.Binding; import org.eclipse.jdt.internal.compiler.lookup.BlockScope; @@ -37,6 +36,8 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; +import com.sun.tools.javac.code.Flags; + /** * This scope is used for code snippet lookup to emulate private, protected and default access. * These accesses inside inner classes are not managed yet. @@ -392,7 +393,7 @@ public MethodBinding findMethodForArray(ArrayBinding receiverType, char[] select if (methodBinding != null) { // handle the method clone() specially... cannot be protected or throw exceptions if (argumentTypes == Binding.NO_PARAMETERS && CharOperation.equals(selector, TypeConstants.CLONE)) - return new MethodBinding((methodBinding.modifiers & ~ClassFileConstants.AccProtected) | ClassFileConstants.AccPublic, TypeConstants.CLONE, methodBinding.returnType, argumentTypes, null, object); + return new MethodBinding((methodBinding.modifiers & ~Flags.PROTECTED) | Flags.PUBLIC, TypeConstants.CLONE, methodBinding.returnType, argumentTypes, null, object); if (canBeSeenByForCodeSnippet(methodBinding, receiverType, invocationSite, this)) return methodBinding; } diff --git a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java index 370ff3e5e41..af75a8f41a0 100644 --- a/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java +++ b/org.eclipse.jdt.core/eval/org/eclipse/jdt/internal/eval/CodeSnippetSkeleton.java @@ -21,7 +21,6 @@ import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; import org.eclipse.jdt.internal.compiler.env.IBinaryField; import org.eclipse.jdt.internal.compiler.env.IBinaryMethod; @@ -34,6 +33,8 @@ import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; import org.eclipse.jdt.internal.core.util.Util; +import com.sun.tools.javac.code.Flags; + /** * The skeleton of the class 'org.eclipse.jdt.internal.eval.target.CodeSnippet' * used at compile time. Note that the method run() is declared to @@ -79,7 +80,7 @@ public char[] getMethodDescriptor() { } @Override public int getModifiers() { - return ClassFileConstants.AccPublic; + return Flags.PUBLIC; } @Override public IBinaryAnnotation[] getParameterAnnotations(int index, char[] classFileName) { @@ -189,7 +190,7 @@ public IBinaryMethod[] getMethods() { } @Override public int getModifiers() { - return ClassFileConstants.AccPublic; + return Flags.PUBLIC; } @Override public char[][][] getMissingTypeNames() { diff --git a/org.eclipse.jdt.core/jdtCompilerAdapter.jar b/org.eclipse.jdt.core/jdtCompilerAdapter.jar index 7961778ad41..824eeeac801 100644 Binary files a/org.eclipse.jdt.core/jdtCompilerAdapter.jar and b/org.eclipse.jdt.core/jdtCompilerAdapter.jar differ diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java index 3f0be8e5f27..5e2cdbc7e4d 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/Flags.java @@ -43,77 +43,77 @@ public final class Flags { * Constant representing the absence of any flag. * @since 3.0 */ - public static final int AccDefault = ClassFileConstants.AccDefault; + public static final int AccDefault = 0; /** * Public access flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccPublic = ClassFileConstants.AccPublic; + public static final int AccPublic = com.sun.tools.javac.code.Flags.PUBLIC; /** * Private access flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccPrivate = ClassFileConstants.AccPrivate; + public static final int AccPrivate = com.sun.tools.javac.code.Flags.PRIVATE; /** * Protected access flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccProtected = ClassFileConstants.AccProtected; + public static final int AccProtected = com.sun.tools.javac.code.Flags.PROTECTED; /** * Static access flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccStatic = ClassFileConstants.AccStatic; + public static final int AccStatic = com.sun.tools.javac.code.Flags.STATIC; /** * Final access flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccFinal = ClassFileConstants.AccFinal; + public static final int AccFinal = com.sun.tools.javac.code.Flags.FINAL; /** * Synchronized access flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccSynchronized = ClassFileConstants.AccSynchronized; + public static final int AccSynchronized = com.sun.tools.javac.code.Flags.SYNCHRONIZED; /** * Volatile property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccVolatile = ClassFileConstants.AccVolatile; + public static final int AccVolatile = com.sun.tools.javac.code.Flags.VOLATILE; /** * Transient property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccTransient = ClassFileConstants.AccTransient; + public static final int AccTransient = com.sun.tools.javac.code.Flags.TRANSIENT; /** * Native property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccNative = ClassFileConstants.AccNative; + public static final int AccNative = com.sun.tools.javac.code.Flags.NATIVE; /** * Interface property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccInterface = ClassFileConstants.AccInterface; + public static final int AccInterface = com.sun.tools.javac.code.Flags.INTERFACE; /** * Abstract property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccAbstract = ClassFileConstants.AccAbstract; + public static final int AccAbstract = com.sun.tools.javac.code.Flags.ABSTRACT; /** * Strictfp property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccStrictfp = ClassFileConstants.AccStrictfp; + public static final int AccStrictfp = com.sun.tools.javac.code.Flags.STRICTFP; /** * Super property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccSuper = ClassFileConstants.AccSuper; + public static final int AccSuper = com.sun.tools.javac.code.Flags.ACC_SUPER; /** * Synthetic property flag. See The Java Virtual Machine Specification for more details. * @since 2.0 */ - public static final int AccSynthetic = ClassFileConstants.AccSynthetic; + public static final int AccSynthetic = com.sun.tools.javac.code.Flags.SYNTHETIC; /** * Deprecated property flag. *

@@ -130,7 +130,7 @@ public final class Flags { * See The Java Virtual Machine Specification for more details. * @since 3.0 */ - public static final int AccBridge = ClassFileConstants.AccBridge; + public static final int AccBridge = com.sun.tools.javac.code.Flags.ACC_BRIDGE; /** * Varargs method property flag (added in J2SE 1.5). @@ -138,21 +138,21 @@ public final class Flags { * See The Java Virtual Machine Specification for more details. * @since 3.0 */ - public static final int AccVarargs = ClassFileConstants.AccVarargs; + public static final int AccVarargs = com.sun.tools.javac.code.Flags.ACC_VARARGS; /** * Enum property flag (added in J2SE 1.5). * See The Java Virtual Machine Specification for more details. * @since 3.0 */ - public static final int AccEnum = ClassFileConstants.AccEnum; + public static final int AccEnum = com.sun.tools.javac.code.Flags.ENUM; /** * Annotation property flag (added in J2SE 1.5). * See The Java Virtual Machine Specification for more details. * @since 3.0 */ - public static final int AccAnnotation = ClassFileConstants.AccAnnotation; + public static final int AccAnnotation = com.sun.tools.javac.code.Flags.ANNOTATION; /** * Default method property flag. @@ -181,7 +181,7 @@ public final class Flags { * * @since 3.14 */ - public static final int AccModule = ClassFileConstants.AccModule; + public static final int AccModule = com.sun.tools.javac.code.Flags.ACC_MODULE; /** * Record property flag. diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java index e10a6f1f621..3b068c4df7d 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/DocumentElementParser.java @@ -23,6 +23,8 @@ import org.eclipse.jdt.internal.compiler.problem.*; import org.eclipse.jdt.internal.compiler.util.Util; +import com.sun.tools.javac.code.Flags; + public class DocumentElementParser extends Parser { IDocumentElementRequestor requestor; private int lastFieldEndPosition; @@ -906,7 +908,7 @@ protected void consumeInterfaceHeaderName1() { this.intPtr--; int declSourceStart = this.intStack[this.intPtr--]; typeDecl.modifiersSourceStart = this.intStack[this.intPtr--]; - typeDecl.modifiers = this.intStack[this.intPtr--] | ClassFileConstants.AccInterface; + typeDecl.modifiers = this.intStack[this.intPtr--] | Flags.INTERFACE; if (typeDecl.declarationSourceStart > declSourceStart) { typeDecl.declarationSourceStart = declSourceStart; } @@ -1216,7 +1218,7 @@ protected void consumeSingleStaticImportDeclarationName() { CharOperation.concatWith(importReference.getImportName(), '.'), importReference.sourceStart, false, - ClassFileConstants.AccStatic); + Flags.STATIC); } /* * @@ -1238,7 +1240,7 @@ protected void consumeSingleTypeImportDeclarationName() { CharOperation.concatWith(importReference.getImportName(), '.'), importReference.sourceStart, false, - ClassFileConstants.AccDefault); + 0); } @Override protected void consumeStaticImportOnDemandDeclarationName() { @@ -1256,7 +1258,7 @@ protected void consumeStaticImportOnDemandDeclarationName() { CharOperation.concatWith(importReference.getImportName(), '.'), importReference.sourceStart, true, - ClassFileConstants.AccStatic); + Flags.STATIC); } /* * @@ -1273,7 +1275,7 @@ protected void consumeStaticInitializer() { initializer.declarationSourceStart, initializer.declarationSourceEnd, this.intArrayStack[this.intArrayPtr--], - ClassFileConstants.AccStatic, + Flags.STATIC, this.intStack[this.intPtr--], initializer.block.sourceStart, initializer.declarationSourceEnd); @@ -1310,7 +1312,7 @@ protected void consumeTypeImportOnDemandDeclarationName() { CharOperation.concatWith(importReference.getImportName(), '.'), importReference.sourceStart, true, - ClassFileConstants.AccDefault); + 0); } /* * Flush javadocs defined prior to a given positions. diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ExtraFlags.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ExtraFlags.java index 7c41d65318c..d164845461a 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ExtraFlags.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/ExtraFlags.java @@ -16,10 +16,11 @@ import org.eclipse.jdt.core.IType; import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.env.IBinaryNestedType; +import com.sun.tools.javac.code.Flags; + public final class ExtraFlags { public final static int HasNonPrivateStaticMemberTypes = 0x0001; public final static int IsMemberType = 0x0002; @@ -45,7 +46,7 @@ public static int getExtraFlags(ClassFileReader reader) { done : for (int i = 0; i < memberTypeCounter; i++) { int modifiers = memberTypes[i].getModifiers(); // if the member type is static and not private - if ((modifiers & ClassFileConstants.AccStatic) != 0 && (modifiers & ClassFileConstants.AccPrivate) == 0) { + if ((modifiers & Flags.STATIC) != 0 && (modifiers & Flags.PRIVATE) == 0) { extraFlags |= ExtraFlags.HasNonPrivateStaticMemberTypes; break done; } @@ -73,7 +74,7 @@ public static int getExtraFlags(IType type) throws JavaModelException { done : for (int i = 0; i < memberTypeCounter; i++) { int flags = memberTypes[i].getFlags(); // if the member type is static and not private - if ((flags & ClassFileConstants.AccStatic) != 0 && (flags & ClassFileConstants.AccPrivate) == 0 ) { + if ((flags & Flags.STATIC) != 0 && (flags & Flags.PRIVATE) == 0 ) { extraFlags |= ExtraFlags.HasNonPrivateStaticMemberTypes; break done; } @@ -95,7 +96,7 @@ public static int getExtraFlags(TypeDeclaration typeDeclaration) { done : for (int i = 0; i < memberTypeCounter; i++) { int modifiers = memberTypes[i].modifiers; // if the member type is static and not private - if ((modifiers & ClassFileConstants.AccStatic) != 0 && (modifiers & ClassFileConstants.AccPrivate) == 0) { + if ((modifiers & Flags.STATIC) != 0 && (modifiers & Flags.PRIVATE) == 0) { extraFlags |= ExtraFlags.HasNonPrivateStaticMemberTypes; break done; } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java index e530a647263..0b2b1716840 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementNotifier.java @@ -56,6 +56,8 @@ import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; import org.eclipse.jdt.internal.compiler.util.HashtableOfObjectToInt; +import com.sun.tools.javac.code.Flags; + @SuppressWarnings({"rawtypes", "unchecked"}) public class SourceElementNotifier { /** @@ -306,7 +308,7 @@ protected void notifySourceElementRequestor(AbstractMethodDeclaration methodDecl int currentModifiers = methodDeclaration.modifiers; currentModifiers &= ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccDeprecated; if (isVarArgs) - currentModifiers |= ClassFileConstants.AccVarargs; + currentModifiers |= Flags.ACC_VARARGS; if (hasDeprecatedAnnotation(methodDeclaration.annotations)) currentModifiers |= ClassFileConstants.AccDeprecated; @@ -362,7 +364,7 @@ protected void notifySourceElementRequestor(AbstractMethodDeclaration methodDecl int currentModifiers = methodDeclaration.modifiers; currentModifiers &= ExtraCompilerModifiers.AccJustFlag | ClassFileConstants.AccDeprecated | ClassFileConstants.AccAnnotationDefault | ExtraCompilerModifiers.AccDefaultMethod; if (isVarArgs) - currentModifiers |= ClassFileConstants.AccVarargs; + currentModifiers |= Flags.ACC_VARARGS; if (hasDeprecatedAnnotation(methodDeclaration.annotations)) currentModifiers |= ClassFileConstants.AccDeprecated; @@ -531,7 +533,7 @@ protected void notifySourceElementRequestor(FieldDeclaration fieldDeclaration, T if (fieldDeclaration.type == null) { // enum constant typeName = declaringType.name; - currentModifiers |= ClassFileConstants.AccEnum; + currentModifiers |= Flags.ENUM; } else { // regular field typeName = CharOperation.concatWith(fieldDeclaration.type.getParameterizedTypeName(), '.'); @@ -696,7 +698,7 @@ protected void notifySourceElementRequestor(TypeDeclaration typeDeclaration, boo boolean isEnumInit = typeDeclaration.allocation != null && typeDeclaration.allocation.enumConstant != null; char[] superclassName; if (isEnumInit) { - currentModifiers |= ClassFileConstants.AccEnum; + currentModifiers |= Flags.ENUM; superclassName = declaringType.name; } else { superclassName = getSuperclassName(typeDeclaration); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java index a2b76fb20d4..54ebac3be93 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/SourceElementParser.java @@ -30,6 +30,8 @@ import org.eclipse.jdt.internal.core.util.CommentRecorderParser; import org.eclipse.jdt.internal.core.util.Messages; +import com.sun.tools.javac.code.Flags; + /** * A source element parser extracts structural and reference information * from a piece of source. @@ -626,9 +628,9 @@ protected void consumeSingleStaticImportDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = newImportReference(tokens, positions, false, ClassFileConstants.AccStatic)); + pushOnAstStack(impt = newImportReference(tokens, positions, false, Flags.STATIC)); - this.modifiers = ClassFileConstants.AccDefault; + this.modifiers = 0; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) if (this.currentToken == TokenNameSEMICOLON){ @@ -643,7 +645,7 @@ protected void consumeSingleStaticImportDeclarationName() { if(!this.statementRecoveryActivated && this.options.sourceLevel < ClassFileConstants.JDK1_5 && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { - impt.modifiers = ClassFileConstants.AccDefault; // convert the static import reference to a non-static importe reference + impt.modifiers = 0; // convert the static import reference to a non-static importe reference problemReporter().invalidUsageOfStaticImports(impt); } @@ -688,7 +690,7 @@ protected void consumeSingleTypeImportDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = newImportReference(tokens, positions, false, ClassFileConstants.AccDefault)); + pushOnAstStack(impt = newImportReference(tokens, positions, false, 0)); if (this.currentToken == TokenNameSEMICOLON){ impt.declarationSourceEnd = this.scanner.currentPosition - 1; @@ -723,11 +725,11 @@ protected void consumeStaticImportOnDemandDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccStatic)); + pushOnAstStack(impt = new ImportReference(tokens, positions, true, Flags.STATIC)); // star end position impt.trailingStarPosition = this.intStack[this.intPtr--]; - this.modifiers = ClassFileConstants.AccDefault; + this.modifiers = 0; this.modifiersSourceStart = -1; // <-- see comment into modifiersFlag(int) if (this.currentToken == TokenNameSEMICOLON){ @@ -742,7 +744,7 @@ protected void consumeStaticImportOnDemandDeclarationName() { if(!this.statementRecoveryActivated && this.options.sourceLevel < ClassFileConstants.JDK1_5 && this.lastErrorEndPositionBeforeRecovery < this.scanner.currentPosition) { - impt.modifiers = ClassFileConstants.AccDefault; // convert the static import reference to a non-static importe reference + impt.modifiers = 0; // convert the static import reference to a non-static importe reference problemReporter().invalidUsageOfStaticImports(impt); } @@ -770,7 +772,7 @@ protected void consumeTypeImportOnDemandDeclarationName() { long[] positions = new long[length]; System.arraycopy(this.identifierStack, this.identifierPtr + 1, tokens, 0, length); System.arraycopy(this.identifierPositionStack, this.identifierPtr + 1, positions, 0, length); - pushOnAstStack(impt = new ImportReference(tokens, positions, true, ClassFileConstants.AccDefault)); + pushOnAstStack(impt = new ImportReference(tokens, positions, true, 0)); // star end position impt.trailingStarPosition = this.intStack[this.intPtr--]; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java index 42eabf05761..b5e107ce051 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/compiler/parser/SourceTypeConverter.java @@ -51,6 +51,8 @@ import org.eclipse.jdt.internal.core.*; import org.eclipse.jdt.internal.core.util.Util; +import com.sun.tools.javac.code.Flags; + public class SourceTypeConverter extends TypeConverter { /* @@ -165,7 +167,7 @@ private CompilationUnitDeclaration convert(ISourceType[] sourceTypes, Compilatio if (packageName.length > 0) // if its null then it is defined in the default package this.unit.currentPackage = - createImportReference(packageName, start, end, false, ClassFileConstants.AccDefault); + createImportReference(packageName, start, end, false, 0); IImportDeclaration[] importDeclarations = topLevelTypeInfo.getHandle().getCompilationUnit().getImports(); int importCount = importDeclarations.length; this.unit.imports = new ImportReference[importCount]; @@ -217,7 +219,7 @@ private CompilationUnitDeclaration convert(IModule module, CompilationResult com private Initializer convert(InitializerElementInfo initializerInfo, CompilationResult compilationResult) throws JavaModelException { Block block = new Block(0); - Initializer initializer = new Initializer(block, ClassFileConstants.AccDefault); + Initializer initializer = new Initializer(block, 0); int start = initializerInfo.getDeclarationSourceStart(); int end = initializerInfo.getDeclarationSourceEnd(); @@ -292,9 +294,9 @@ private FieldDeclaration convert(SourceField fieldHandle, TypeDeclaration type, field.declarationSourceStart = fieldInfo.getDeclarationSourceStart(); field.declarationSourceEnd = fieldInfo.getDeclarationSourceEnd(); int modifiers = fieldInfo.getModifiers(); - boolean isEnumConstant = (modifiers & ClassFileConstants.AccEnum) != 0; + boolean isEnumConstant = (modifiers & Flags.ENUM) != 0; if (isEnumConstant) { - field.modifiers = modifiers & ~ClassFileConstants.AccEnum; // clear AccEnum bit onto AST (binding will add it) + field.modifiers = modifiers & ~Flags.ENUM; // clear AccEnum bit onto AST (binding will add it) } else { field.modifiers = modifiers; field.type = createTypeReference(fieldInfo.getTypeName(), start, end); @@ -344,7 +346,7 @@ private QualifiedAllocationExpression convert(IJavaElement localType, FieldDecla anonymousLocalTypeDeclaration.superInterfaces = null; anonymousLocalTypeDeclaration.allocation = expression; if (enumConstant != null) { - anonymousLocalTypeDeclaration.modifiers &= ~ClassFileConstants.AccEnum; + anonymousLocalTypeDeclaration.modifiers &= ~Flags.ENUM; expression.enumConstant = enumConstant; expression.type = null; } @@ -425,8 +427,8 @@ private AbstractMethodDeclaration convert(SourceMethod methodHandle, SourceMetho method = decl; } method.selector = methodHandle.getElementName().toCharArray(); - boolean isVarargs = (modifiers & ClassFileConstants.AccVarargs) != 0; - method.modifiers = modifiers & ~ClassFileConstants.AccVarargs; + boolean isVarargs = (modifiers & Flags.ACC_VARARGS) != 0; + method.modifiers = modifiers & ~Flags.ACC_VARARGS; method.sourceStart = start; method.sourceEnd = end; method.declarationSourceStart = methodInfo.getDeclarationSourceStart(); @@ -456,7 +458,7 @@ private AbstractMethodDeclaration convert(SourceMethod methodHandle, SourceMetho argumentNames[i], position, typeReference, - ClassFileConstants.AccDefault); + 0); // do not care whether was final or not // convert 1.5 specific constructs only if compliance is 1.5 or above if (this.has1_5Compliance) { @@ -665,7 +667,7 @@ private TypeDeclaration convert(SourceType typeHandle, CompilationResult compila SourceMethod sourceMethod = sourceMethods[i]; SourceMethodElementInfo methodInfo = (SourceMethodElementInfo)sourceMethod.getElementInfo(); boolean isConstructor = methodInfo.isConstructor(); - if ((methodInfo.getModifiers() & ClassFileConstants.AccAbstract) != 0) { + if ((methodInfo.getModifiers() & Flags.ABSTRACT) != 0) { hasAbstractMethods = true; } if ((isConstructor ? needConstructor : needMethod)) { diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java index a955087b896..5e86550ac15 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMethod.java @@ -26,7 +26,6 @@ import org.eclipse.jdt.core.JavaModelException; import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; import org.eclipse.jdt.internal.compiler.env.IBinaryMethod; import org.eclipse.jdt.internal.compiler.env.IBinaryType; @@ -207,7 +206,7 @@ public int getElementType() { public int getFlags() throws JavaModelException { IBinaryMethod info = (IBinaryMethod) getElementInfo(); int modifiers = info.getModifiers(); - if (((IType) this.getParent()).isInterface() && (modifiers & (ClassFileConstants.AccAbstract | ClassFileConstants.AccStatic)) == 0) + if (((IType) this.getParent()).isInterface() && (modifiers & (com.sun.tools.javac.code.Flags.ABSTRACT | com.sun.tools.javac.code.Flags.STATIC)) == 0) modifiers |= ExtraCompilerModifiers.AccDefaultMethod; return modifiers; } @@ -301,7 +300,7 @@ public String[] getParameterNames() throws JavaModelException { if (paramCount != 0) { // don't try to look for javadoc for synthetic methods int modifiers = getFlags(); - if ((modifiers & ClassFileConstants.AccSynthetic) != 0) { + if ((modifiers & com.sun.tools.javac.code.Flags.SYNTHETIC) != 0) { return this.parameterNames = getRawParameterNames(paramCount); } JavadocContents javadocContents = null; diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java index 07ed1f29de3..e9201262752 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryType.java @@ -351,7 +351,7 @@ public boolean isRecordComponent() throws JavaModelException { @Override public int getFlags() throws JavaModelException { IBinaryType info = (IBinaryType) getElementInfo(); - return info.getModifiers() & ~ClassFileConstants.AccSuper; + return info.getModifiers() & ~com.sun.tools.javac.code.Flags.ACC_SUPER; } @Override diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java index db684d6e3fe..bf0d882491e 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryTypeConverter.java @@ -35,7 +35,6 @@ import org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; import org.eclipse.jdt.internal.compiler.ast.TypeReference; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader; import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; import org.eclipse.jdt.internal.compiler.parser.TypeConverter; @@ -104,7 +103,7 @@ public TypeDeclaration buildTypeDeclaration(IType type, CompilationUnitDeclarati char[][] packageName = Util.toCharArrays(pkg.names); if (packageName.length > 0) { - compilationUnit.currentPackage = new ImportReference(packageName, new long[]{0}, false, ClassFileConstants.AccDefault); + compilationUnit.currentPackage = new ImportReference(packageName, new long[]{0}, false, 0); } /* convert type */ @@ -201,7 +200,7 @@ private AbstractMethodDeclaration convert(IMethod method, IType type) throws Jav argumentNames[i].toCharArray(), 0, typeReference, - ClassFileConstants.AccDefault); + 0); // do not care whether was final or not } diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java index 6fab72a54ef..73734fad127 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java @@ -18,7 +18,6 @@ import org.eclipse.jdt.core.*; import org.eclipse.jdt.core.compiler.CharOperation; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; import org.eclipse.jdt.internal.compiler.env.IBinaryElementValuePair; import org.eclipse.jdt.internal.compiler.env.IBinaryField; @@ -168,7 +167,7 @@ private void generateFieldInfos(IType type, IBinaryType typeInfo, HashMap newEle IBinaryField fieldInfo = fields[i]; // If the type is a record and this is an instance field, it can only be a record component // Filter out - if (typeInfo.isRecord() && (fieldInfo.getModifiers() & ClassFileConstants.AccStatic) == 0) + if (typeInfo.isRecord() && (fieldInfo.getModifiers() & com.sun.tools.javac.code.Flags.STATIC) == 0) continue; BinaryField field = new BinaryField((JavaElement)type, manager.intern(new String(fieldInfo.getName()))); newElements.put(field, fieldInfo); diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java index ee07cbbb21e..6d20ccc84bd 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/SelectionRequestor.java @@ -38,7 +38,6 @@ import org.eclipse.jdt.internal.compiler.ast.CastExpression; import org.eclipse.jdt.internal.compiler.ast.LambdaExpression; import org.eclipse.jdt.internal.compiler.ast.LocalDeclaration; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.eclipse.jdt.internal.compiler.lookup.LocalTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.LocalVariableBinding; @@ -187,16 +186,16 @@ public void acceptModule(char[] moduleName, char[] uniqueKey, int start, int end @Override public void acceptType(char[] packageName, char[] typeName, int modifiers, boolean isDeclaration, char[] uniqueKey, int start, int end) { int acceptFlags = 0; - int kind = modifiers & (ClassFileConstants.AccInterface|ClassFileConstants.AccEnum|ClassFileConstants.AccAnnotation); + int kind = modifiers & (com.sun.tools.javac.code.Flags.INTERFACE|com.sun.tools.javac.code.Flags.ENUM|com.sun.tools.javac.code.Flags.ANNOTATION); switch (kind) { - case ClassFileConstants.AccAnnotation: - case ClassFileConstants.AccAnnotation|ClassFileConstants.AccInterface: + case com.sun.tools.javac.code.Flags.ANNOTATION: + case com.sun.tools.javac.code.Flags.ANNOTATION|com.sun.tools.javac.code.Flags.INTERFACE: acceptFlags = NameLookup.ACCEPT_ANNOTATIONS; break; - case ClassFileConstants.AccEnum: + case com.sun.tools.javac.code.Flags.ENUM: acceptFlags = NameLookup.ACCEPT_ENUMS; break; - case ClassFileConstants.AccInterface: + case com.sun.tools.javac.code.Flags.INTERFACE: acceptFlags = NameLookup.ACCEPT_INTERFACES; break; default: diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java index a0578b84d11..dddec693826 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/hierarchy/HierarchyBinaryType.java @@ -20,7 +20,6 @@ import org.eclipse.jdt.core.Signature; import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.compiler.env.IBinaryAnnotation; import org.eclipse.jdt.internal.compiler.env.IBinaryField; import org.eclipse.jdt.internal.compiler.env.IBinaryMethod; @@ -33,6 +32,8 @@ import org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.ExternalAnnotationStatus; import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants; +import com.sun.tools.javac.code.Flags; + public class HierarchyBinaryType implements IBinaryType { private int modifiers; private char[] sourceName; @@ -293,7 +294,7 @@ public char[] sourceFileName() { @Override public String toString() { StringBuilder buffer = new StringBuilder(); - if (this.modifiers == ClassFileConstants.AccPublic) { + if (this.modifiers == Flags.PUBLIC) { buffer.append("public "); //$NON-NLS-1$ } switch (TypeDeclaration.kind(this.modifiers)) { diff --git a/org.eclipse.jdt.core/pom.xml b/org.eclipse.jdt.core/pom.xml index 780da102ec8..a0543741197 100644 --- a/org.eclipse.jdt.core/pom.xml +++ b/org.eclipse.jdt.core/pom.xml @@ -34,6 +34,8 @@ false + --add-exports + jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java index 6ef6c6e556d..aa6a6e98c5e 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ConstructorDeclarationPattern.java @@ -16,7 +16,8 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.internal.compiler.ExtraFlags; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; public class ConstructorDeclarationPattern extends ConstructorPattern { public int extraFlags; @@ -126,7 +127,7 @@ public void decodeIndexKey(char[] key) { this.modifiers = key[last-1] + (key[last]<<16); } else { - this.modifiers = ClassFileConstants.AccPublic; + this.modifiers = Flags.PUBLIC; } } diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java index 05f8d172c14..d5e90814b52 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/MethodDeclarationPattern.java @@ -18,7 +18,8 @@ import org.eclipse.jdt.core.search.SearchPattern; import org.eclipse.jdt.internal.compiler.ExtraFlags; import org.eclipse.jdt.internal.compiler.ast.ASTNode; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; + +import com.sun.tools.javac.code.Flags; public class MethodDeclarationPattern extends MethodPattern { @@ -256,7 +257,7 @@ public void decodeIndexKey(char[] key) { this.modifiers = key[last-1] + (key[last]<<16); } else { - this.modifiers = ClassFileConstants.AccPublic; + this.modifiers = Flags.PUBLIC; } start = slash + 1; diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java index b30a2a3af15..0f2c837e4f1 100644 --- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java +++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/TypeDeclarationPattern.java @@ -19,10 +19,11 @@ import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.core.search.IJavaSearchConstants; import org.eclipse.jdt.core.search.SearchPattern; -import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; import org.eclipse.jdt.internal.core.index.*; import org.eclipse.jdt.internal.core.search.indexing.IIndexConstants; +import com.sun.tools.javac.code.Flags; + public class TypeDeclarationPattern extends JavaSearchPattern { public char[] simpleName; @@ -253,15 +254,15 @@ public void decodeIndexKey(char[] key) { protected void decodeModifiers() { // Extract suffix from modifiers instead of index key - switch (this.modifiers & (ClassFileConstants.AccInterface|ClassFileConstants.AccEnum|ClassFileConstants.AccAnnotation)) { - case ClassFileConstants.AccAnnotation: - case ClassFileConstants.AccAnnotation+ClassFileConstants.AccInterface: + switch (this.modifiers & (Flags.INTERFACE|Flags.ENUM|Flags.ANNOTATION)) { + case Flags.ANNOTATION: + case Flags.ANNOTATION+Flags.INTERFACE: this.typeSuffix = ANNOTATION_TYPE_SUFFIX; break; - case ClassFileConstants.AccEnum: + case Flags.ENUM: this.typeSuffix = ENUM_SUFFIX; break; - case ClassFileConstants.AccInterface: + case Flags.INTERFACE: this.typeSuffix = INTERFACE_SUFFIX; break; default: