### 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 8 Jan 2009 20:31:35 -0000 @@ -493,10 +493,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 8 Jan 2009 20:31:35 -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 8 Jan 2009 20:31:36 -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/Scope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java,v retrieving revision 1.346 diff -u -r1.346 Scope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 5 Dec 2008 12:41:29 -0000 1.346 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java 8 Jan 2009 20:31:36 -0000 @@ -2809,16 +2809,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 :