Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 207974 Details for
Bug 365437
Private methods tagged with @Inject should not be flagged with unused warning
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch from Olivier
patch_365455.txt (text/plain), 26.44 KB, created by
Srikanth Sankaran
on 2011-12-06 07:00:22 EST
(
hide
)
Description:
Patch from Olivier
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2011-12-06 07:00:22 EST
Size:
26.44 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java >index 1d28367..8e0959c 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java >@@ -12,6 +12,7 @@ package org.eclipse.jdt.core.tests.compiler.regression; > > import java.util.Map; > >+import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > > import junit.framework.Test; >@@ -24,7 +25,7 @@ public class NonFatalErrorTest extends AbstractRegressionTest { > // All specified tests which does not belong to the class are skipped... > static { > // TESTS_NAMES = new String[] { "test127" }; >-// TESTS_NUMBERS = new int[] { 5 }; >+// TESTS_NUMBERS = new int[] { 7 }; > // TESTS_RANGE = new int[] { 169, 180 }; > } > >@@ -258,4 +259,41 @@ public class NonFatalErrorTest extends AbstractRegressionTest { > // javac options > JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */); > } >+ public void test007() { >+ if (this.complianceLevel < ClassFileConstants.JDK1_5) { >+ return; >+ } >+ Map customOptions = getCompilerOptions(); >+ customOptions.put(CompilerOptions.OPTION_FatalOptionalError, >+ CompilerOptions.ENABLED); >+ customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal, >+ CompilerOptions.ERROR); >+ customOptions.put(CompilerOptions.OPTION_SuppressWarnings, >+ CompilerOptions.ENABLED); >+ customOptions.put(CompilerOptions.OPTION_SuppressOptionalErrors, >+ CompilerOptions.ENABLED); >+ customOptions.put(CompilerOptions.OPTION_ReportUnusedWarningToken, >+ CompilerOptions.ERROR); >+ runConformTest( >+ new String[] { /* test files */ >+ "X.java", >+ "public class X {\n" + >+ " @SuppressWarnings(\"unused\")\n" + >+ " static void foo() {\n" + >+ " String s = null;\n" + >+ " System.out.println(\"SUCCESS\");\n" + >+ " }\n" + >+ " public static void main(String argv[]) {\n" + >+ " foo();\n" + >+ " }\n" + >+ "}" >+ }, >+ "SUCCESS" /* expected output string */, >+ null /* no class libraries */, >+ true, >+ null, >+ customOptions /* custom options */, >+ // compiler results >+ null /* do not check error string */); >+ } > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >index f6d98fd..345bf73 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java >@@ -392,6 +392,15 @@ public abstract class AbstractMethodDeclaration > return false; > } > >+ public boolean isFiltered(CategorizedProblem problem) { >+ if (this.scope == null) return false; >+ CompilationUnitScope compilationUnitScope = this.scope.compilationUnitScope(); >+ if (compilationUnitScope == null) return false; >+ CompilationUnitDeclaration referenceContext = compilationUnitScope.referenceContext; >+ if (referenceContext == null) return false; >+ return referenceContext.filterProblem(problem); >+ } >+ > public boolean isInitializationMethod() { > > return false; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >index bc76ad7..a4bff4e 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java >@@ -168,12 +168,6 @@ public abstract class Annotation extends Expression { > case TypeIds.T_JavaLangInvokeMethodHandlePolymorphicSignature : > tagBits |= TagBits.AnnotationPolymorphicSignature; > break; >- case TypeIds.T_JavaxAnnotationPostConstruct : >- tagBits |= TagBits.AnnotationPostConstruct; >- break; >- case TypeIds.T_JavaxAnnotationPreDestroy : >- tagBits |= TagBits.AnnotationPreDestroy; >- break; > case TypeIds.T_ConfiguredAnnotationNullable : > tagBits |= TagBits.AnnotationNullable; > break; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >index eb6f64a..9c4f29d 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >@@ -339,7 +339,35 @@ public void finalizeProblems() { > } > } > } >- >+public boolean filterProblem(CategorizedProblem problem) { >+ if (this.suppressWarningsCount == 0) return false; >+ CompilerOptions options = this.scope.compilerOptions(); >+ int problemID = problem.getID(); >+ int irritant = ProblemReporter.getIrritant(problemID); >+ boolean isError = problem.isError(); >+ if (isError) { >+ if (irritant == 0) { >+ return false; >+ } >+ if (!options.suppressOptionalErrors) { >+ return false; >+ } >+ } >+ int start = problem.getSourceStart(); >+ int end = problem.getSourceEnd(); >+ nextSuppress: for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) { >+ long position = this.suppressWarningScopePositions[iSuppress]; >+ int startSuppress = (int) (position >>> 32); >+ int endSuppress = (int) position; >+ if (start < startSuppress) continue nextSuppress; >+ if (end > endSuppress) continue nextSuppress; >+ if (!this.suppressWarningIrritants[iSuppress].isSet(irritant)) >+ continue nextSuppress; >+ // discard suppressed warning >+ return true; >+ } >+ return false; >+} > /** > * Bytecode generation > */ >@@ -389,7 +417,12 @@ public char[] getMainTypeName() { > public boolean isEmpty() { > return (this.currentPackage == null) && (this.imports == null) && (this.types == null); > } >- >+public boolean isFiltered(CategorizedProblem problem) { >+ if (this.scope == null) return false; >+ CompilationUnitDeclaration referenceContext = this.scope.referenceContext; >+ if (referenceContext == null) return false; >+ return referenceContext.filterProblem(problem); >+} > public boolean isPackageInfo() { > return CharOperation.equals(getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME); > } >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >index f5d41ea..90c6e31 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java >@@ -709,7 +709,14 @@ private void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) { > this.enumValuesSyntheticfield = this.binding.addSyntheticFieldForEnumValues(); > } > } >- >+public boolean isFiltered(CategorizedProblem problem) { >+ if (this.scope == null) return false; >+ CompilationUnitScope compilationUnitScope = this.scope.compilationUnitScope(); >+ if (compilationUnitScope == null) return false; >+ CompilationUnitDeclaration referenceContext = compilationUnitScope.referenceContext; >+ if (referenceContext == null) return false; >+ return referenceContext.filterProblem(problem); >+} > public final static int kind(int flags) { > switch (flags & (ClassFileConstants.AccInterface|ClassFileConstants.AccAnnotation|ClassFileConstants.AccEnum)) { > case ClassFileConstants.AccInterface : >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java >index 3357d7d..d81ec1c 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java >@@ -303,10 +303,6 @@ private int scanAnnotation(int offset, boolean expectRuntimeVisibleAnno, boolean > currentOffset += 2; > return readTargetValue(currentOffset); > } >- if (CharOperation.equals(typeName, ConstantPool.JAVAX_ANNOTATION_PREDESTROY)) { >- this.standardAnnotationTagBits |= TagBits.AnnotationPreDestroy; >- return currentOffset; >- } > break; > case 32: > if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_RETENTION)) { >@@ -317,10 +313,6 @@ private int scanAnnotation(int offset, boolean expectRuntimeVisibleAnno, boolean > this.standardAnnotationTagBits |= TagBits.AnnotationInherited; > return currentOffset; > } >- if (CharOperation.equals(typeName, ConstantPool.JAVAX_ANNOTATION_POSTCONSTRUCT)) { >- this.standardAnnotationTagBits |= TagBits.AnnotationPostConstruct; >- return currentOffset; >- } > break; > case 33: > if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_DOCUMENTED)) { >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java >index c875c9b..aca35f6 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java >@@ -248,8 +248,6 @@ public class ConstantPool implements ClassFileConstants, TypeIds { > public static final char[] JAVA_LANG_SAFEVARARGS = "Ljava/lang/SafeVarargs;".toCharArray(); //$NON-NLS-1$ > // java 7 java.lang.invoke.MethodHandle.invokeExact(..)/invokeGeneric(..) > public static final char[] JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE = "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".toCharArray(); //$NON-NLS-1$ >- public static final char[] JAVAX_ANNOTATION_POSTCONSTRUCT = "Ljavax/annotation/PostConstruct;".toCharArray(); //$NON-NLS-1$ >- public static final char[] JAVAX_ANNOTATION_PREDESTROY = "Ljavax/annotation/PreDestroy;".toCharArray(); //$NON-NLS-1$ > > public static final char[] HashCode = "hashCode".toCharArray(); //$NON-NLS-1$ > public static final char[] HashCodeSignature = "()I".toCharArray(); //$NON-NLS-1$; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java >index ec3f72b..0885c55 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ReferenceContext.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -25,6 +25,8 @@ public interface ReferenceContext { > > CompilationResult compilationResult(); > >+ boolean isFiltered(CategorizedProblem problem); >+ > boolean hasErrors(); > > void tagAsHavingErrors(); >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java >index c88c4a1..c8098c9 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java >@@ -54,11 +54,10 @@ public static AnnotationBinding[] addStandardAnnotations(AnnotationBinding[] rec > count++; > if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0) > count++; >- if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) >- count++; >- if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) >- count++; >- // count must be different from 0 >+ if (count == 0) { >+ // this is possible if bits were set for null annotations >+ return recordedAnnotations; >+ } > > int index = recordedAnnotations.length; > AnnotationBinding[] result = new AnnotationBinding[index + count]; >@@ -81,10 +80,6 @@ public static AnnotationBinding[] addStandardAnnotations(AnnotationBinding[] rec > result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env); > if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0) > result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS, env); >- if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) >- result[index++] = buildMarkerAnnotation(TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT, env); >- if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) >- result[index++] = buildMarkerAnnotation(TypeConstants.JAVAX_ANNOTATION_PREDESTROY, env); > return result; > } > >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >index 75de854..868686f 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >@@ -380,28 +380,14 @@ public void computeId() { > switch (this.compoundName.length) { > > case 3 : >- if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0]) >- && !CharOperation.equals(TypeConstants.JAVAX, this.compoundName[0])) >+ if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])) > return; >- >+ > char[] packageName = this.compoundName[1]; > if (packageName.length == 0) return; // just to be safe > char[] typeName = this.compoundName[2]; > if (typeName.length == 0) return; // just to be safe > // remaining types MUST be in java.*.* >- if (CharOperation.equals(TypeConstants.JAVAX, this.compoundName[0])) { >- if (CharOperation.equals(TypeConstants.ANNOTATION, this.compoundName[1])) { >- switch (typeName[0]) { >- case 'P' : >- if (CharOperation.equals(typeName, TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT[2])) >- this.id = TypeIds.T_JavaxAnnotationPostConstruct; >- if (CharOperation.equals(typeName, TypeConstants.JAVAX_ANNOTATION_PREDESTROY[2])) >- this.id = TypeIds.T_JavaxAnnotationPreDestroy; >- return; >- } >- } >- return; >- } > if (!CharOperation.equals(TypeConstants.LANG, this.compoundName[1])) { > switch (packageName[0]) { > case 'i' : >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >index 9ba6da0..14e9610 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >@@ -129,10 +129,6 @@ public interface TagBits { > long AnnotationSafeVarargs = ASTNode.Bit52L; > /** @since 3.7 - java 7 MethodHandle.invokeExact(..)/invokeGeneric(..)*/ > long AnnotationPolymorphicSignature = ASTNode.Bit53L; >- /** @since 3.8 */ >- long AnnotationPreDestroy = ASTNode.Bit54L; >- /** @since 3.8 */ >- long AnnotationPostConstruct = ASTNode.Bit55L; > /** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */ > long AnnotationNullable = ASTNode.Bit56L; > /** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */ >@@ -152,8 +148,6 @@ public interface TagBits { > | AnnotationSuppressWarnings > | AnnotationSafeVarargs > | AnnotationPolymorphicSignature >- | AnnotationPostConstruct >- | AnnotationPreDestroy > | AnnotationNullable > | AnnotationNonNull > | AnnotationNonNullByDefault >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >index 0bbef47..6a96119 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java >@@ -177,18 +177,6 @@ public interface TypeConstants { > char[] SYNTHETIC_ACCESS_METHOD_PREFIX = "access$".toCharArray(); //$NON-NLS-1$ > char[] SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX = " enum constant initialization$".toCharArray(); //$NON-NLS-1$ > char[] SYNTHETIC_STATIC_FACTORY = "<factory>".toCharArray(); //$NON-NLS-1$ >- char[][] JAVAX_ANNOTATION_POSTCONSTRUCT = >- new char[][] { >- JAVAX, >- ANNOTATION, >- "PostConstruct".toCharArray() //$NON-NLS-1$ >- }; >- char[][] JAVAX_ANNOTATION_PREDESTROY = >- new char[][] { >- JAVAX, >- ANNOTATION, >- "PreDestroy".toCharArray() //$NON-NLS-1$ >- }; > > // synthetic package-info name > public static final char[] PACKAGE_INFO_NAME = "package-info".toCharArray(); //$NON-NLS-1$ >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java >index 7fff434..5f3a1c4 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java >@@ -100,11 +100,6 @@ public interface TypeIds { > > // java 7 java.lang.AutoCloseable > final int T_JavaLangAutoCloseable = 62; >- >- // new in 3.8 >- final int T_JavaxAnnotationPostConstruct = 63; >- >- final int T_JavaxAnnotationPreDestroy = 64; > > // new in 3.8 for null annotations: > final int T_ConfiguredAnnotationNullable = 65; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java >index 6baad99..3a46539 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemHandler.java >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -150,6 +150,10 @@ public void handle( > case ProblemSeverities.Error : > record(problem, unitResult, referenceContext); > if ((severity & ProblemSeverities.Fatal) != 0) { >+ if ((severity & ProblemSeverities.Optional) != 0 && referenceContext.isFiltered(problem)) { >+ // don't abort for optional problem treated as fatal if ignored with @SuppressWarnings >+ return; >+ } > referenceContext.tagAsHavingErrors(); > // should abort ? > int abortLevel; >diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >index 9b83933..7934900 100644 >--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >@@ -88,6 +88,7 @@ import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; > import org.eclipse.jdt.internal.compiler.flow.FlowInfo; > import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.impl.ReferenceContext; >+import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; > import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; > import org.eclipse.jdt.internal.compiler.lookup.Binding; > import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers; >@@ -7691,9 +7692,16 @@ public void unusedPrivateMethod(AbstractMethodDeclaration methodDecl) { > && CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) { > return; > } >- if ((method.tagBits & (TagBits.AnnotationPostConstruct | TagBits.AnnotationPreDestroy)) != 0) { >- // PostConstruct and PreDestroy method are ignored >- return; >+ AnnotationBinding[] annotations = method.getAnnotations(); >+ int annotationsLength = annotations.length; >+ if (annotationsLength > 0) { >+ for (int i = 0; i < annotationsLength; i++) { >+ char[][] annotationName = annotations[0].getAnnotationType().compoundName; >+ if (annotationName.length > 1 >+ && CharOperation.equals(annotationName[0], TypeConstants.JAVAX)) { >+ return; >+ } >+ } > } > this.handle( > IProblem.UnusedPrivateMethod, >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java >index 94e6db1..60300ca 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java >@@ -87,12 +87,6 @@ protected IAnnotation[] getStandardAnnotations(long tagBits) { > if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) { > annotations.add(getAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS)); > } >- if ((tagBits & TagBits.AnnotationPostConstruct) != 0) { >- annotations.add(getAnnotation(TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT)); >- } >- if ((tagBits & TagBits.AnnotationPreDestroy) != 0) { >- annotations.add(getAnnotation(TypeConstants.JAVAX_ANNOTATION_PREDESTROY)); >- } > // note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries > return (IAnnotation[]) annotations.toArray(new IAnnotation[annotations.size()]); > } >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 bcf7ceb..13612a5 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 >@@ -108,12 +108,6 @@ private void generateStandardAnnotationsInfos(JavaElement javaElement, char[] pa > if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) { > generateStandardAnnotation(javaElement, TypeConstants.JAVA_LANG_SAFEVARARGS, Annotation.NO_MEMBER_VALUE_PAIRS, newElements); > } >- if ((tagBits & TagBits.AnnotationPostConstruct) != 0) { >- generateStandardAnnotation(javaElement, TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT, Annotation.NO_MEMBER_VALUE_PAIRS, newElements); >- } >- if ((tagBits & TagBits.AnnotationPreDestroy) != 0) { >- generateStandardAnnotation(javaElement, TypeConstants.JAVAX_ANNOTATION_PREDESTROY, Annotation.NO_MEMBER_VALUE_PAIRS, newElements); >- } > // note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries > } > >diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java >index c242fb5..bcb0401 100644 >--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java >+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java >@@ -46,6 +46,9 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { > super(document); > } > private void addBinaryStandardAnnotations(long annotationTagBits) { >+ if ((annotationTagBits & TagBits.AllStandardAnnotationsMask) == 0) { >+ return; >+ } > if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) { > char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_TARGET; > addAnnotationTypeReference(compoundName[compoundName.length-1]); >@@ -85,14 +88,6 @@ public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { > TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE; > addAnnotationTypeReference(compoundName[compoundName.length-1]); > } >- if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) { >- char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT; >- addAnnotationTypeReference(compoundName[compoundName.length-1]); >- } >- if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) { >- char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_PREDESTROY; >- addAnnotationTypeReference(compoundName[compoundName.length-1]); >- } > } > private void addBinaryTargetAnnotation(long bits) { > char[][] compoundName = null; >diff --git a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java >index 37608aa..07b5442 100644 >--- a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java >+++ b/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java >@@ -90,6 +90,9 @@ private boolean checkParameters(char[] methodDescriptor, char[][] parameterSimpl > return true; > } > private boolean checkStandardAnnotations(long annotationTagBits, TypeReferencePattern pattern) { >+ if ((annotationTagBits & TagBits.AllStandardAnnotationsMask) == 0) { >+ return false; >+ } > if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) { > char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_TARGET; > if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern) || >@@ -146,18 +149,6 @@ private boolean checkStandardAnnotations(long annotationTagBits, TypeReferencePa > return true; > } > } >- if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) { >- char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT; >- if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) { >- return true; >- } >- } >- if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) { >- char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_PREDESTROY; >- if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) { >- return true; >- } >- } > return false; > } > private boolean checkTypeName(char[] simpleName, char[] qualification, char[] fullyQualifiedTypeName, boolean isCaseSensitive, boolean isCamelCase) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 365437
:
207974
|
209012
|
209200
|
209250