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 52391 Details for
Bug 161214
[compiler] Fup on bug 159709: improve deprecation marks propagation
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Reviewed fix
org.eclipse.jdt.core_03.txt (text/plain), 24.98 KB, created by
Maxime Daniel
on 2006-10-20 09:49:06 EDT
(
hide
)
Description:
Reviewed fix
Filename:
MIME Type:
Creator:
Maxime Daniel
Created:
2006-10-20 09:49:06 EDT
Size:
24.98 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java,v >retrieving revision 1.14 >diff -u -r1.14 SyntheticMethodBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java 12 Oct 2006 17:57:21 -0000 1.14 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java 20 Oct 2006 13:49:44 -0000 >@@ -40,7 +40,7 @@ > public SyntheticMethodBinding(FieldBinding targetField, boolean isReadAccess, ReferenceBinding declaringClass) { > > this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass; > SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods(); > int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length; >@@ -144,7 +144,7 @@ > > public SyntheticMethodBinding(FieldBinding targetField, ReferenceBinding declaringClass, TypeBinding enumBinding, char[] selector) { > this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass; > SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods(); > int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length; >@@ -225,7 +225,7 @@ > // 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.AccAbstract | ClassFileConstants.AccNative | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature); >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > this.returnType = overridenMethodToBridge.returnType; > this.parameters = overridenMethodToBridge.parameters; > this.thrownExceptions = overridenMethodToBridge.thrownExceptions; >@@ -243,7 +243,7 @@ > this.declaringClass = declaringEnum; > this.selector = selector; > this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic; >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > this.thrownExceptions = Binding.NO_EXCEPTIONS; > if (selector == TypeConstants.VALUES) { > this.returnType = declaringEnum.scope.createArrayType(declaringEnum, 1); >@@ -270,7 +270,7 @@ > > this.targetMethod = accessedConstructor; > this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccSynthetic; >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > SourceTypeBinding sourceType = (SourceTypeBinding) accessedConstructor.declaringClass; > SyntheticMethodBinding[] knownSyntheticMethods = > sourceType.syntheticMethods(); >@@ -350,7 +350,7 @@ > > this.targetMethod = accessedMethod; > this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic; >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > SourceTypeBinding declaringSourceType = (SourceTypeBinding) receiverType; > SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods(); > int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java,v >retrieving revision 1.138 >diff -u -r1.138 SourceTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 9 Jun 2006 10:20:47 -0000 1.138 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java 20 Oct 2006 13:49:44 -0000 >@@ -969,22 +969,22 @@ > } > > /** >- * Compute the tagbits for @Deprecated annotations; avoiding resolving >- * entire annotation if not necessary. > * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits() > */ > public void initializeDeprecatedAnnotationTagBits() { >- if ((this.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) == 0) { >+ if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) { > TypeDeclaration typeDecl = this.scope.referenceContext; > boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation; > try { > typeDecl.staticInitializerScope.insideTypeAnnotation = true; > ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this); >+ this.tagBits |= TagBits.DeprecatedAnnotationResolved; > } finally { > typeDecl.staticInitializerScope.insideTypeAnnotation = old; > } >- if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) >+ if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) { > this.modifiers |= ClassFileConstants.AccDeprecated; >+ } > } > } > >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java,v >retrieving revision 1.10 >diff -u -r1.10 SyntheticFieldBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java 10 May 2006 18:03:50 -0000 1.10 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java 20 Oct 2006 13:49:44 -0000 >@@ -19,6 +19,6 @@ > public SyntheticFieldBinding(char[] name, TypeBinding type, int modifiers, ReferenceBinding declaringClass, Constant constant, int index) { > super(name, type, modifiers, declaringClass, constant); > this.index = index; >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java,v >retrieving revision 1.27 >diff -u -r1.27 TagBits.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 25 Apr 2006 19:36:31 -0000 1.27 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java 20 Oct 2006 13:49:44 -0000 >@@ -77,32 +77,33 @@ > // standard annotations > // 9-bits for targets > long AnnotationResolved = ASTNode.Bit34L; >- long AnnotationTarget = ASTNode.Bit35L; // @Target({}) only sets this bit >- long AnnotationForType = ASTNode.Bit36L; >- long AnnotationForField = ASTNode.Bit37L; >- long AnnotationForMethod = ASTNode.Bit38L; >- long AnnotationForParameter = ASTNode.Bit39L; >- long AnnotationForConstructor = ASTNode.Bit40L; >- long AnnotationForLocalVariable = ASTNode.Bit41L; >- long AnnotationForAnnotationType = ASTNode.Bit42L; >- long AnnotationForPackage = ASTNode.Bit43L; >+ long DeprecatedAnnotationResolved = ASTNode.Bit35L; >+ long AnnotationTarget = ASTNode.Bit36L; // @Target({}) only sets this bit >+ long AnnotationForType = ASTNode.Bit37L; >+ long AnnotationForField = ASTNode.Bit38L; >+ long AnnotationForMethod = ASTNode.Bit39L; >+ long AnnotationForParameter = ASTNode.Bit40L; >+ long AnnotationForConstructor = ASTNode.Bit41L; >+ long AnnotationForLocalVariable = ASTNode.Bit42L; >+ long AnnotationForAnnotationType = ASTNode.Bit43L; >+ long AnnotationForPackage = ASTNode.Bit44L; > long AnnotationTargetMASK = AnnotationTarget > | AnnotationForType | AnnotationForField > | AnnotationForMethod | AnnotationForParameter > | AnnotationForConstructor | AnnotationForLocalVariable > | AnnotationForAnnotationType | AnnotationForPackage; > // 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention >- long AnnotationSourceRetention = ASTNode.Bit44L; >- long AnnotationClassRetention = ASTNode.Bit45L; >+ long AnnotationSourceRetention = ASTNode.Bit45L; >+ long AnnotationClassRetention = ASTNode.Bit46L; > long AnnotationRuntimeRetention = AnnotationSourceRetention | AnnotationClassRetention; > long AnnotationRetentionMASK = AnnotationSourceRetention | AnnotationClassRetention | AnnotationRuntimeRetention; > // marker annotations >- long AnnotationDeprecated = ASTNode.Bit46L; >- long AnnotationDocumented = ASTNode.Bit47L; >- long AnnotationInherited = ASTNode.Bit48L; >- long AnnotationOverride = ASTNode.Bit49L; >- long AnnotationSuppressWarnings = ASTNode.Bit50L; >+ long AnnotationDeprecated = ASTNode.Bit47L; >+ long AnnotationDocumented = ASTNode.Bit48L; >+ long AnnotationInherited = ASTNode.Bit49L; >+ long AnnotationOverride = ASTNode.Bit50L; >+ long AnnotationSuppressWarnings = ASTNode.Bit51L; > long AllStandardAnnotationsMask = AnnotationTargetMASK | AnnotationRetentionMASK | AnnotationDeprecated | AnnotationDocumented | AnnotationInherited | AnnotationOverride | AnnotationSuppressWarnings; > >- long DefaultValueResolved = ASTNode.Bit51L; >+ long DefaultValueResolved = ASTNode.Bit52L; > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java,v >retrieving revision 1.46 >diff -u -r1.46 FieldBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java 29 Mar 2006 02:45:27 -0000 1.46 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java 20 Oct 2006 13:49:44 -0000 >@@ -237,7 +237,7 @@ > if ((originalField.tagBits & TagBits.AnnotationResolved) == 0 && originalField.declaringClass instanceof SourceTypeBinding) { > ClassScope scope = ((SourceTypeBinding) originalField.declaringClass).scope; > if (scope == null) { // synthetic fields do not have a scope nor any annotations >- this.tagBits |= TagBits.AnnotationResolved; >+ this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > return 0; > } > TypeDeclaration typeDecl = scope.referenceContext; >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java,v >retrieving revision 1.21 >diff -u -r1.21 MemberTypeBinding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java 16 Oct 2006 08:07:14 -0000 1.21 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java 20 Oct 2006 13:49:44 -0000 >@@ -11,9 +11,6 @@ > package org.eclipse.jdt.internal.compiler.lookup; > > import org.eclipse.jdt.core.compiler.CharOperation; >-import org.eclipse.jdt.internal.compiler.ast.ASTNode; >-import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; >-import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; > > public final class MemberTypeBinding extends NestedTypeBinding { > public MemberTypeBinding(char[][] compoundName, ClassScope scope, SourceTypeBinding enclosingType) { >@@ -36,23 +33,22 @@ > > return constantPoolName = CharOperation.concat(enclosingType().constantPoolName(), sourceName, '$'); > } >+ >+/** >+ * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits() >+ */ > public void initializeDeprecatedAnnotationTagBits() { >- if ((this.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) == 0) { >- ReferenceBinding enclosing = this.enclosingType(); >- enclosing.initializeDeprecatedAnnotationTagBits(); >- TypeDeclaration typeDecl = this.scope.referenceContext; >- boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation; >- try { >- typeDecl.staticInitializerScope.insideTypeAnnotation = true; >- ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this); >- } finally { >- typeDecl.staticInitializerScope.insideTypeAnnotation = old; >- } >- if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) { >- this.modifiers |= ClassFileConstants.AccDeprecated; >- } else if ((enclosing.modifiers & (ClassFileConstants.AccDeprecated | >- ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0) { >- this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; >+ if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) { >+ super.initializeDeprecatedAnnotationTagBits(); >+ if ((this.tagBits & TagBits.AnnotationDeprecated) == 0) { >+ // check enclosing type >+ ReferenceBinding enclosing; >+ if (((enclosing = this.enclosingType()).tagBits & TagBits.DeprecatedAnnotationResolved) == 0) { >+ enclosing.initializeDeprecatedAnnotationTagBits(); >+ } >+ if (enclosing.isViewedAsDeprecated()) { >+ this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; >+ } > } > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java,v >retrieving revision 1.27 >diff -u -r1.27 Binding.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java 29 Mar 2006 02:40:11 -0000 1.27 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java 20 Oct 2006 13:49:43 -0000 >@@ -72,7 +72,7 @@ > } > > /** >- * Compute the tagbits for @Deprecated annotations; avoiding resolving >+ * Compute the tag bits for @Deprecated annotations, avoiding resolving > * entire annotation if not necessary. > * @see org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding#initializeDeprecatedAnnotationTagBits() > */ >Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v >retrieving revision 1.140 >diff -u -r1.140 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 8 Sep 2006 13:36:02 -0000 1.140 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 20 Oct 2006 13:49:43 -0000 >@@ -358,6 +358,8 @@ > else > modifiers |= ClassFileConstants.AccStatic; > } >+ if (enclosingType.isViewedAsDeprecated() && !sourceType.isDeprecated()) >+ modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly; > } else if (sourceType.isLocalType()) { > if (sourceType.isEnum()) { > problemReporter().illegalLocalTypeDeclaration(referenceContext); >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v >retrieving revision 1.75 >diff -u -r1.75 ASTNode.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 18 Oct 2006 19:09:55 -0000 1.75 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 20 Oct 2006 13:49:42 -0000 >@@ -475,13 +475,13 @@ > case Binding.PACKAGE : > PackageBinding packageBinding = (PackageBinding) recipient; > if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return; >- packageBinding.tagBits |= TagBits.AnnotationResolved; >+ packageBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > break; > case Binding.TYPE : > case Binding.GENERIC_TYPE : > ReferenceBinding type = (ReferenceBinding) recipient; > if ((type.tagBits & TagBits.AnnotationResolved) != 0) return; >- type.tagBits |= TagBits.AnnotationResolved; >+ type.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > if (length > 0) { > instances = new AnnotationBinding[length]; > type.setAnnotations(instances); >@@ -490,7 +490,7 @@ > case Binding.METHOD : > MethodBinding method = (MethodBinding) recipient; > if ((method.tagBits & TagBits.AnnotationResolved) != 0) return; >- method.tagBits |= TagBits.AnnotationResolved; >+ method.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > if (length > 0) { > instances = new AnnotationBinding[length]; > method.setAnnotations(instances); >@@ -499,7 +499,7 @@ > case Binding.FIELD : > FieldBinding field = (FieldBinding) recipient; > if ((field.tagBits & TagBits.AnnotationResolved) != 0) return; >- field.tagBits |= TagBits.AnnotationResolved; >+ field.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > if (length > 0) { > instances = new AnnotationBinding[length]; > field.setAnnotations(instances); >@@ -508,7 +508,7 @@ > case Binding.LOCAL : > LocalVariableBinding local = (LocalVariableBinding) recipient; > if ((local.tagBits & TagBits.AnnotationResolved) != 0) return; >- local.tagBits |= TagBits.AnnotationResolved; >+ local.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved); > if (length > 0) { > instances = new AnnotationBinding[length]; > local.setAnnotations(instances); >@@ -548,77 +548,104 @@ > } > } > >- /** >- * Figures if @Deprecated annotation is specified, do not resolve entire annotations. >- */ >- public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) { >- if (annotations == null) >- return; >- int length = annotations.length; >- if (length == 0) >- return; >- if (recipient != null) { >- switch (recipient.kind()) { >- case Binding.PACKAGE : >- PackageBinding packageBinding = (PackageBinding) recipient; >- if ((packageBinding.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; >- break; >- case Binding.TYPE : >- case Binding.GENERIC_TYPE : >- ReferenceBinding type = (ReferenceBinding) recipient; >- if ((type.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; >- break; >- case Binding.METHOD : >- MethodBinding method = (MethodBinding) recipient; >- if ((method.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; >- break; >- case Binding.FIELD : >- FieldBinding field = (FieldBinding) recipient; >- if ((field.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; >- break; >- case Binding.LOCAL : >- LocalVariableBinding local = (LocalVariableBinding) recipient; >- if ((local.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return; >- break; >- default : >- return; >- } >- } >- for (int i = 0; i < length; i++) { >- TypeReference annotationTypeRef = annotations[i].type; >- // only resolve type name if 'Deprecated' last token >- if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return; >- TypeBinding annotationType = annotations[i].type.resolveType(scope); >- if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) { >- if (recipient != null) { >- switch (recipient.kind()) { >- case Binding.PACKAGE : >- PackageBinding packageBinding = (PackageBinding) recipient; >- packageBinding.tagBits |= TagBits.AnnotationDeprecated; >- break; >- case Binding.TYPE : >- case Binding.GENERIC_TYPE : >- case Binding.TYPE_PARAMETER : >- ReferenceBinding type = (ReferenceBinding) recipient; >- type.tagBits |= TagBits.AnnotationDeprecated; >- break; >- case Binding.METHOD : >- MethodBinding method = (MethodBinding) recipient; >- method.tagBits |= TagBits.AnnotationDeprecated; >- break; >- case Binding.FIELD : >- FieldBinding field = (FieldBinding) recipient; >- field.tagBits |= TagBits.AnnotationDeprecated; >- break; >- case Binding.LOCAL : >- LocalVariableBinding local = (LocalVariableBinding) recipient; >- local.tagBits |= TagBits.AnnotationDeprecated; >- break; >- } >+/** >+ * Figures if @Deprecated annotation is specified, do not resolve entire annotations. >+ */ >+public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) { >+ if (recipient != null) { >+ int kind = recipient.kind(); >+ if (annotations != null) { >+ int length; >+ if ((length = annotations.length) >= 0) { >+ switch (kind) { >+ case Binding.PACKAGE : >+ PackageBinding packageBinding = (PackageBinding) recipient; >+ if ((packageBinding.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; >+ break; >+ case Binding.TYPE : >+ case Binding.GENERIC_TYPE : >+ ReferenceBinding type = (ReferenceBinding) recipient; >+ if ((type.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; >+ break; >+ case Binding.METHOD : >+ MethodBinding method = (MethodBinding) recipient; >+ if ((method.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; >+ break; >+ case Binding.FIELD : >+ FieldBinding field = (FieldBinding) recipient; >+ if ((field.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; >+ break; >+ case Binding.LOCAL : >+ LocalVariableBinding local = (LocalVariableBinding) recipient; >+ if ((local.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return; >+ break; >+ default : >+ return; >+ } >+ for (int i = 0; i < length; i++) { >+ TypeReference annotationTypeRef = annotations[i].type; >+ // only resolve type name if 'Deprecated' last token >+ if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return; >+ TypeBinding annotationType = annotations[i].type.resolveType(scope); >+ if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) { >+ switch (kind) { >+ case Binding.PACKAGE : >+ PackageBinding packageBinding = (PackageBinding) recipient; >+ packageBinding.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); >+ return; >+ case Binding.TYPE : >+ case Binding.GENERIC_TYPE : >+ case Binding.TYPE_PARAMETER : >+ ReferenceBinding type = (ReferenceBinding) recipient; >+ type.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); >+ return; >+ case Binding.METHOD : >+ MethodBinding method = (MethodBinding) recipient; >+ method.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); >+ return; >+ case Binding.FIELD : >+ FieldBinding field = (FieldBinding) recipient; >+ field.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); >+ return; >+ case Binding.LOCAL : >+ LocalVariableBinding local = (LocalVariableBinding) recipient; >+ local.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved); >+ return; >+ default: >+ return; >+ } >+ } > } > } > } >+ switch (kind) { >+ case Binding.PACKAGE : >+ PackageBinding packageBinding = (PackageBinding) recipient; >+ packageBinding.tagBits |= TagBits.DeprecatedAnnotationResolved; >+ return; >+ case Binding.TYPE : >+ case Binding.GENERIC_TYPE : >+ case Binding.TYPE_PARAMETER : >+ ReferenceBinding type = (ReferenceBinding) recipient; >+ type.tagBits |= TagBits.DeprecatedAnnotationResolved; >+ return; >+ case Binding.METHOD : >+ MethodBinding method = (MethodBinding) recipient; >+ method.tagBits |= TagBits.DeprecatedAnnotationResolved; >+ return; >+ case Binding.FIELD : >+ FieldBinding field = (FieldBinding) recipient; >+ field.tagBits |= TagBits.DeprecatedAnnotationResolved; >+ return; >+ case Binding.LOCAL : >+ LocalVariableBinding local = (LocalVariableBinding) recipient; >+ local.tagBits |= TagBits.DeprecatedAnnotationResolved; >+ return; >+ default: >+ return; >+ } > } >+} > > public int sourceStart() { > return this.sourceStart;
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 161214
:
52221
|
52301
| 52391