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 122138 Details for
Bug 214948
Incorrect deprecation warning on annotation instances
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch.txt (text/plain), 11.83 KB, created by
Kent Johnson
on 2009-01-09 12:45:39 EST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Kent Johnson
Created:
2009-01-09 12:45:39 EST
Size:
11.83 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java,v >retrieving revision 1.84 >diff -u -r1.84 CompilationUnitDeclaration.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java 7 Jan 2009 17:34:23 -0000 1.84 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java 9 Jan 2009 17:43:12 -0000 >@@ -19,6 +19,7 @@ > 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.impl.CompilerOptions; > import org.eclipse.jdt.internal.compiler.impl.Constant; > import org.eclipse.jdt.internal.compiler.impl.IrritantSet; >@@ -180,6 +181,14 @@ > return this.compilationResult; > } > >+public void createPackageInfoType() { >+ TypeDeclaration declaration = new TypeDeclaration(this.compilationResult); >+ declaration.name = TypeConstants.PACKAGE_INFO_NAME; >+ declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; >+ declaration.javadoc = this.javadoc; >+ this.types[0] = declaration; // Assumes the first slot is meant for this type >+} >+ > /* > * Finds the matching type amoung this compilation unit types. > * Returns null if no type with this name is found. >@@ -493,10 +502,6 @@ > syntheticTypeDeclaration.javadoc = new Javadoc(syntheticTypeDeclaration.declarationSourceStart, syntheticTypeDeclaration.declarationSourceStart); > } > syntheticTypeDeclaration.resolve(this.scope); >- // resolve annotations if any, skip this step if we don't have a valid scope due to an earlier error. (bug 252555) >- if (this.currentPackage!= null && this.currentPackage.annotations != null && syntheticTypeDeclaration.staticInitializerScope != null) { >- resolveAnnotations(syntheticTypeDeclaration.staticInitializerScope, this.currentPackage.annotations, this.scope.fPackage); >- } > /* > * resolve javadoc package if any, skip this step if we don't have a valid scope due to an earlier error (bug 252555) > * we do it now as the javadoc in the fake type won't be resolved. The peculiar usage of MethodScope to resolve the >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java,v >retrieving revision 1.48 >diff -u -r1.48 PackageBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 14 Nov 2008 20:28:34 -0000 1.48 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java 9 Jan 2009 17:43:12 -0000 >@@ -205,6 +205,25 @@ > return null; > } > >+/** >+ * Compute the tagbits for standard annotations. For source types, these could require >+ * lazily resolving corresponding annotation nodes, in case of forward references. >+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits() >+ */ >+public long getAnnotationTagBits() { >+ if ((this.tagBits & TagBits.AnnotationResolved) != 0) >+ return this.tagBits; >+ >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); >+ if (this.compoundName == CharOperation.NO_CHAR_CHAR) >+ return this.tagBits; >+ >+ ReferenceBinding packageInfo = this.getType(TypeConstants.PACKAGE_INFO_NAME); >+ if (packageInfo != null) >+ this.tagBits |= (packageInfo.getAnnotationTagBits() & TagBits.AllStandardAnnotationsMask); >+ return this.tagBits; >+} >+ > /* API > * Answer the receiver's binding type from Binding.BindingID. > */ >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java,v >retrieving revision 1.128 >diff -u -r1.128 ReferenceBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 5 Dec 2008 16:49:14 -0000 1.128 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java 9 Jan 2009 17:43:12 -0000 >@@ -1175,7 +1175,7 @@ > */ > public final boolean isViewedAsDeprecated() { > return (this.modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0 >- || (getPackage().tagBits & TagBits.AnnotationDeprecated) != 0; >+ || (getPackage().getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0; > } > > public ReferenceBinding[] memberTypes() { >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java,v >retrieving revision 1.124 >diff -u -r1.124 CompilationUnitScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 7 Jan 2009 17:34:23 -0000 1.124 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java 9 Jan 2009 17:43:12 -0000 >@@ -94,10 +94,7 @@ > // resolve package annotations now if this is "package-info.java". > if (this.referenceContext.types == null || this.referenceContext.types.length == 0) { > this.referenceContext.types = new TypeDeclaration[1]; >- TypeDeclaration declaration = new TypeDeclaration(this.referenceContext.compilationResult); >- this.referenceContext.types[0] = declaration; >- declaration.name = TypeConstants.PACKAGE_INFO_NAME; >- declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; >+ this.referenceContext.createPackageInfoType(); > firstIsSynthetic = true; > } > // ensure the package annotations are copied over before resolution >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v >retrieving revision 1.347 >diff -u -r1.347 Scope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 8 Jan 2009 20:51:04 -0000 1.347 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 9 Jan 2009 17:43:13 -0000 >@@ -2937,16 +2937,15 @@ > MethodBinding context = ((AbstractMethodDeclaration)methodScope.referenceContext).binding; > if (context != null && context.isViewedAsDeprecated()) > return true; >- } else { >- SourceTypeBinding type = ((BlockScope)this).referenceType().binding; >+ } else if (methodScope.initializedField != null && methodScope.initializedField.isViewedAsDeprecated()) { > // inside field declaration ? check field modifier to see if deprecated >- if (methodScope.initializedField != null && methodScope.initializedField.isViewedAsDeprecated()) >+ return true; >+ } >+ SourceTypeBinding declaringType = ((BlockScope)this).referenceType().binding; >+ if (declaringType != null) { >+ declaringType.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then >+ if (declaringType.isViewedAsDeprecated()) > return true; >- if (type != null) { >- type.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then >- if (type.isViewedAsDeprecated()) >- return true; >- } > } > break; > case Scope.CLASS_SCOPE : >Index: compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java,v >retrieving revision 1.397 >diff -u -r1.397 Parser.java >--- compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 5 Dec 2008 15:57:56 -0000 1.397 >+++ compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java 9 Jan 2009 17:43:13 -0000 >@@ -2831,12 +2831,7 @@ > // nothing to do by default > if (this.compilationUnit.isPackageInfo()) { > this.compilationUnit.types = new TypeDeclaration[1]; >- // create a fake interface declaration >- TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); >- declaration.name = TypeConstants.PACKAGE_INFO_NAME; >- declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; >- this.compilationUnit.types[0] = declaration; >- declaration.javadoc = this.compilationUnit.javadoc; >+ this.compilationUnit.createPackageInfoType(); > } > } > protected void consumeEmptyMemberValueArrayInitializer() { >@@ -4040,12 +4035,7 @@ > // InternalCompilationUnit ::= ImportDeclarations ReduceImports > if (this.compilationUnit.isPackageInfo()) { > this.compilationUnit.types = new TypeDeclaration[1]; >- // create a fake interface declaration >- TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); >- declaration.name = TypeConstants.PACKAGE_INFO_NAME; >- declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; >- this.compilationUnit.types[0] = declaration; >- declaration.javadoc = this.compilationUnit.javadoc; >+ this.compilationUnit.createPackageInfoType(); > } > } > protected void consumeInternalCompilationUnitWithTypes() { >@@ -4060,12 +4050,7 @@ > this.compilationUnit.types = new TypeDeclaration[length + 1]; > this.astPtr -= length; > System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types, 1, length); >- // create a fake interface declaration >- TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult); >- declaration.name = TypeConstants.PACKAGE_INFO_NAME; >- declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface; >- this.compilationUnit.types[0] = declaration; >- declaration.javadoc = this.compilationUnit.javadoc; >+ this.compilationUnit.createPackageInfoType(); > } else { > this.compilationUnit.types = new TypeDeclaration[length]; > this.astPtr -= length; >Index: model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java,v >retrieving revision 1.107 >diff -u -r1.107 IncrementalImageBuilder.java >--- model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java 27 Nov 2008 20:31:16 -0000 1.107 >+++ model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java 9 Jan 2009 17:43:13 -0000 >@@ -17,6 +17,7 @@ > import org.eclipse.jdt.core.compiler.*; > import org.eclipse.jdt.internal.compiler.*; > import org.eclipse.jdt.internal.compiler.classfmt.*; >+import org.eclipse.jdt.internal.compiler.lookup.TypeConstants; > import org.eclipse.jdt.internal.compiler.problem.*; > import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable; > import org.eclipse.jdt.internal.compiler.util.SuffixConstants; >@@ -575,6 +576,8 @@ > if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(resourceName)) { > IPath typePath = resource.getFullPath().removeFirstSegments(segmentCount).removeFileExtension(); > String typeLocator = resource.getProjectRelativePath().toString(); >+ if (CharOperation.equals(typePath.lastSegment().toCharArray(), TypeConstants.PACKAGE_INFO_NAME)) >+ addDependentsOf(typePath.removeLastSegments(1) , false); // indict the package since the package-info file is changed > switch (sourceDelta.getKind()) { > case IResourceDelta.ADDED : > if (JavaBuilder.DEBUG)
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 214948
:
86597
|
121836
|
121875
|
121950
|
122006
|
122065
|
122138
|
122149
|
122306