View | Details | Raw Unified | Return to bug 161214 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticMethodBinding.java (-6 / +6 lines)
Lines 40-46 Link Here
40
	public SyntheticMethodBinding(FieldBinding targetField, boolean isReadAccess, ReferenceBinding declaringClass) {
40
	public SyntheticMethodBinding(FieldBinding targetField, boolean isReadAccess, ReferenceBinding declaringClass) {
41
41
42
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic;
42
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic;
43
		this.tagBits |= TagBits.AnnotationResolved;
43
		this.tagBits |= TagBits.AnnotationResolvedMASK;
44
		SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass;
44
		SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass;
45
		SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods();
45
		SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods();
46
		int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
46
		int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
Lines 144-150 Link Here
144
144
145
	public SyntheticMethodBinding(FieldBinding targetField, ReferenceBinding declaringClass, TypeBinding enumBinding, char[] selector) {
145
	public SyntheticMethodBinding(FieldBinding targetField, ReferenceBinding declaringClass, TypeBinding enumBinding, char[] selector) {
146
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic;
146
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic;
147
		this.tagBits |= TagBits.AnnotationResolved;
147
		this.tagBits |= TagBits.AnnotationResolvedMASK;
148
		SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass;
148
		SourceTypeBinding declaringSourceType = (SourceTypeBinding) declaringClass;
149
		SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods();
149
		SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods();
150
		int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
150
		int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
Lines 225-231 Link Here
225
	    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
225
	    // amongst other, clear the AccGenericSignature, so as to ensure no remains of original inherited persist (101794)
226
	    // also use the modifiers from the target method, as opposed to inherited one (147690)
226
	    // also use the modifiers from the target method, as opposed to inherited one (147690)
227
	    this.modifiers = (targetMethod.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccNative  | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature);
227
	    this.modifiers = (targetMethod.modifiers | ClassFileConstants.AccBridge | ClassFileConstants.AccSynthetic) & ~(ClassFileConstants.AccAbstract | ClassFileConstants.AccNative  | ClassFileConstants.AccFinal | ExtraCompilerModifiers.AccGenericSignature);
228
		this.tagBits |= TagBits.AnnotationResolved;
228
		this.tagBits |= TagBits.AnnotationResolvedMASK;
229
	    this.returnType = overridenMethodToBridge.returnType;
229
	    this.returnType = overridenMethodToBridge.returnType;
230
	    this.parameters = overridenMethodToBridge.parameters;
230
	    this.parameters = overridenMethodToBridge.parameters;
231
	    this.thrownExceptions = overridenMethodToBridge.thrownExceptions;
231
	    this.thrownExceptions = overridenMethodToBridge.thrownExceptions;
Lines 243-249 Link Here
243
	    this.declaringClass = declaringEnum;
243
	    this.declaringClass = declaringEnum;
244
	    this.selector = selector;
244
	    this.selector = selector;
245
	    this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
245
	    this.modifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccStatic;
246
		this.tagBits |= TagBits.AnnotationResolved;
246
		this.tagBits |= TagBits.AnnotationResolvedMASK;
247
	    this.thrownExceptions = Binding.NO_EXCEPTIONS;
247
	    this.thrownExceptions = Binding.NO_EXCEPTIONS;
248
		if (selector == TypeConstants.VALUES) {
248
		if (selector == TypeConstants.VALUES) {
249
		    this.returnType = declaringEnum.scope.createArrayType(declaringEnum, 1);
249
		    this.returnType = declaringEnum.scope.createArrayType(declaringEnum, 1);
Lines 270-276 Link Here
270
	
270
	
271
		this.targetMethod = accessedConstructor;
271
		this.targetMethod = accessedConstructor;
272
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccSynthetic;
272
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccSynthetic;
273
		this.tagBits |= TagBits.AnnotationResolved;
273
		this.tagBits |= TagBits.AnnotationResolvedMASK;
274
		SourceTypeBinding sourceType = (SourceTypeBinding) accessedConstructor.declaringClass; 
274
		SourceTypeBinding sourceType = (SourceTypeBinding) accessedConstructor.declaringClass; 
275
		SyntheticMethodBinding[] knownSyntheticMethods = 
275
		SyntheticMethodBinding[] knownSyntheticMethods = 
276
			sourceType.syntheticMethods(); 
276
			sourceType.syntheticMethods(); 
Lines 350-356 Link Here
350
		
350
		
351
		this.targetMethod = accessedMethod;
351
		this.targetMethod = accessedMethod;
352
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic;
352
		this.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccStatic | ClassFileConstants.AccSynthetic;
353
		this.tagBits |= TagBits.AnnotationResolved;
353
		this.tagBits |= TagBits.AnnotationResolvedMASK;
354
		SourceTypeBinding declaringSourceType = (SourceTypeBinding) receiverType;
354
		SourceTypeBinding declaringSourceType = (SourceTypeBinding) receiverType;
355
		SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods();
355
		SyntheticMethodBinding[] knownAccessMethods = declaringSourceType.syntheticMethods();
356
		int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
356
		int methodId = knownAccessMethods == null ? 0 : knownAccessMethods.length;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-13 / +13 lines)
Lines 969-991 Link Here
969
}
969
}
970
970
971
/**
971
/**
972
 * Compute the tagbits for @Deprecated annotations; avoiding resolving
973
 * entire annotation if not necessary.
974
 * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits()
972
 * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits()
975
 */
973
 */
976
public void initializeDeprecatedAnnotationTagBits() {
974
public void initializeDeprecatedAnnotationTagBits() {
977
	if ((this.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) == 0) {
975
//	if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
978
		TypeDeclaration typeDecl = this.scope.referenceContext;
976
	// guard at calling point to save calls
979
		boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
977
	TypeDeclaration typeDecl = this.scope.referenceContext;
980
		try {
978
	boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
981
			typeDecl.staticInitializerScope.insideTypeAnnotation = true;
979
	try {
982
			ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
980
		typeDecl.staticInitializerScope.insideTypeAnnotation = true;
983
		} finally {
981
		ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
984
			typeDecl.staticInitializerScope.insideTypeAnnotation = old;
982
	} finally {
985
		}
983
		typeDecl.staticInitializerScope.insideTypeAnnotation = old;
986
		if ((this.tagBits & TagBits.AnnotationDeprecated) != 0)
987
			this.modifiers |= ClassFileConstants.AccDeprecated;
988
	}
984
	}
985
	if ((this.tagBits & TagBits.AnnotationDeprecated) != 0)
986
		this.modifiers |= ClassFileConstants.AccDeprecated;
987
	this.tagBits |= TagBits.DeprecatedAnnotationResolved;
988
//	}
989
}
989
}
990
990
991
/**
991
/**
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/SyntheticFieldBinding.java (-1 / +1 lines)
Lines 19-24 Link Here
19
	public SyntheticFieldBinding(char[] name, TypeBinding type, int modifiers, ReferenceBinding declaringClass, Constant constant, int index) {
19
	public SyntheticFieldBinding(char[] name, TypeBinding type, int modifiers, ReferenceBinding declaringClass, Constant constant, int index) {
20
		super(name, type, modifiers, declaringClass, constant);
20
		super(name, type, modifiers, declaringClass, constant);
21
		this.index = index;
21
		this.index = index;
22
		this.tagBits |= TagBits.AnnotationResolved;
22
		this.tagBits |= TagBits.AnnotationResolvedMASK;
23
	}
23
	}
24
}
24
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java (+4 lines)
Lines 77-82 Link Here
77
	// standard annotations
77
	// standard annotations
78
	// 9-bits for targets
78
	// 9-bits for targets
79
	long AnnotationResolved = ASTNode.Bit34L;
79
	long AnnotationResolved = ASTNode.Bit34L;
80
	long DeprecatedAnnotationResolved = ASTNode.Bit52L;
81
	long AnnotationResolvedMASK = AnnotationResolved | DeprecatedAnnotationResolved;
82
		// should have AnnotationsResolved => DeprecatedAnnotationResolved
80
	long AnnotationTarget = ASTNode.Bit35L; // @Target({}) only sets this bit
83
	long AnnotationTarget = ASTNode.Bit35L; // @Target({}) only sets this bit
81
	long AnnotationForType = ASTNode.Bit36L;
84
	long AnnotationForType = ASTNode.Bit36L;
82
	long AnnotationForField = ASTNode.Bit37L;
85
	long AnnotationForField = ASTNode.Bit37L;
Lines 105-108 Link Here
105
	long AllStandardAnnotationsMask = AnnotationTargetMASK | AnnotationRetentionMASK | AnnotationDeprecated | AnnotationDocumented | AnnotationInherited |  AnnotationOverride | AnnotationSuppressWarnings;
108
	long AllStandardAnnotationsMask = AnnotationTargetMASK | AnnotationRetentionMASK | AnnotationDeprecated | AnnotationDocumented | AnnotationInherited |  AnnotationOverride | AnnotationSuppressWarnings;
106
	
109
	
107
	long DefaultValueResolved = ASTNode.Bit51L;
110
	long DefaultValueResolved = ASTNode.Bit51L;
111
	// 52L used above
108
}
112
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/FieldBinding.java (-1 / +1 lines)
Lines 237-243 Link Here
237
	if ((originalField.tagBits & TagBits.AnnotationResolved) == 0 && originalField.declaringClass instanceof SourceTypeBinding) {
237
	if ((originalField.tagBits & TagBits.AnnotationResolved) == 0 && originalField.declaringClass instanceof SourceTypeBinding) {
238
		ClassScope scope = ((SourceTypeBinding) originalField.declaringClass).scope;
238
		ClassScope scope = ((SourceTypeBinding) originalField.declaringClass).scope;
239
		if (scope == null) { // synthetic fields do not have a scope nor any annotations
239
		if (scope == null) { // synthetic fields do not have a scope nor any annotations
240
			this.tagBits |= TagBits.AnnotationResolved;
240
			this.tagBits |= TagBits.AnnotationResolvedMASK;
241
			return 0;
241
			return 0;
242
		}
242
		}
243
		TypeDeclaration typeDecl = scope.referenceContext;
243
		TypeDeclaration typeDecl = scope.referenceContext;
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MemberTypeBinding.java (-17 / +14 lines)
Lines 11-19 Link Here
11
package org.eclipse.jdt.internal.compiler.lookup;
11
package org.eclipse.jdt.internal.compiler.lookup;
12
12
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
15
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
16
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
17
14
18
public final class MemberTypeBinding extends NestedTypeBinding {
15
public final class MemberTypeBinding extends NestedTypeBinding {
19
public MemberTypeBinding(char[][] compoundName, ClassScope scope, SourceTypeBinding enclosingType) {
16
public MemberTypeBinding(char[][] compoundName, ClassScope scope, SourceTypeBinding enclosingType) {
Lines 36-60 Link Here
36
33
37
	return constantPoolName = CharOperation.concat(enclosingType().constantPoolName(), sourceName, '$');
34
	return constantPoolName = CharOperation.concat(enclosingType().constantPoolName(), sourceName, '$');
38
}
35
}
36
37
/**
38
 * @see org.eclipse.jdt.internal.compiler.lookup.Binding#initializeDeprecatedAnnotationTagBits()
39
 */
39
public void initializeDeprecatedAnnotationTagBits() {
40
public void initializeDeprecatedAnnotationTagBits() {
40
	if ((this.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) == 0) {
41
//	if ((this.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
41
		ReferenceBinding enclosing = this.enclosingType();
42
	// guard at calling point to save calls
42
		enclosing.initializeDeprecatedAnnotationTagBits();
43
	super.initializeDeprecatedAnnotationTagBits();
43
		TypeDeclaration typeDecl = this.scope.referenceContext;
44
	if ((this.tagBits & TagBits.AnnotationDeprecated) == 0) {
44
		boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
45
		// check enclosing type
45
		try {
46
		ReferenceBinding enclosing;
46
			typeDecl.staticInitializerScope.insideTypeAnnotation = true;
47
		if (((enclosing = this.enclosingType()).tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
47
			ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
48
			enclosing.initializeDeprecatedAnnotationTagBits();
48
		} finally {
49
			typeDecl.staticInitializerScope.insideTypeAnnotation = old;
50
		}
49
		}
51
		if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) {
50
		if (enclosing.isViewedAsDeprecated()) {
52
			this.modifiers |= ClassFileConstants.AccDeprecated;
53
		} else if ((enclosing.modifiers & (ClassFileConstants.AccDeprecated |
54
						ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0) {
55
			this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
51
			this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
56
		}
52
		}
57
	}
53
	}
54
//	}
58
}
55
}
59
public String toString() {
56
public String toString() {
60
	return "Member type : " + new String(sourceName()) + " " + super.toString(); //$NON-NLS-2$ //$NON-NLS-1$
57
	return "Member type : " + new String(sourceName()) + " " + super.toString(); //$NON-NLS-2$ //$NON-NLS-1$
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-3 / +9 lines)
Lines 2642-2648 Link Here
2642
					if (methodScope.initializedField != null && methodScope.initializedField.isViewedAsDeprecated())
2642
					if (methodScope.initializedField != null && methodScope.initializedField.isViewedAsDeprecated())
2643
						return true;
2643
						return true;
2644
					if (type != null) {
2644
					if (type != null) {
2645
						type.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2645
						if ((type.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
2646
							type.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2647
						}
2646
						if (type.isViewedAsDeprecated())
2648
						if (type.isViewedAsDeprecated())
2647
							return true;
2649
							return true;
2648
					}
2650
					}
Lines 2651-2657 Link Here
2651
			case Scope.CLASS_SCOPE :
2653
			case Scope.CLASS_SCOPE :
2652
				ReferenceBinding context = ((ClassScope)this).referenceType().binding;
2654
				ReferenceBinding context = ((ClassScope)this).referenceType().binding;
2653
				if (context != null) {
2655
				if (context != null) {
2654
					context.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2656
					if ((context.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
2657
						context.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2658
					}
2655
					if (context.isViewedAsDeprecated()) 
2659
					if (context.isViewedAsDeprecated()) 
2656
						return true;
2660
						return true;
2657
				}
2661
				}
Lines 2662-2668 Link Here
2662
				if (unit.types != null && unit.types.length > 0) {
2666
				if (unit.types != null && unit.types.length > 0) {
2663
					SourceTypeBinding type = unit.types[0].binding;
2667
					SourceTypeBinding type = unit.types[0].binding;
2664
					if (type != null) {
2668
					if (type != null) {
2665
						type.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2669
						if ((type.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
2670
							type.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2671
						}
2666
						if (type.isViewedAsDeprecated())
2672
						if (type.isViewedAsDeprecated())
2667
							return true;
2673
							return true;
2668
					}
2674
					}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java (-2 / +4 lines)
Lines 72-79 Link Here
72
	}
72
	}
73
	
73
	
74
	/**
74
	/**
75
	 * Compute the tagbits for @Deprecated annotations; avoiding resolving
75
	 * Compute the tag bits for @Deprecated annotations, avoiding resolving
76
	 * entire annotation if not necessary.
76
	 * entire annotation if not necessary. The caller should guard against
77
	 * multiple calls by testing against the DeprecatedAnnotationResolved tag 
78
	 * bit.
77
	 * @see org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding#initializeDeprecatedAnnotationTagBits()
79
	 * @see org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding#initializeDeprecatedAnnotationTagBits()
78
	 */
80
	 */
79
	public void initializeDeprecatedAnnotationTagBits() {
81
	public void initializeDeprecatedAnnotationTagBits() {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java (+2 lines)
Lines 358-363 Link Here
358
				else
358
				else
359
					modifiers |= ClassFileConstants.AccStatic;
359
					modifiers |= ClassFileConstants.AccStatic;
360
			}
360
			}
361
			if (enclosingType.isViewedAsDeprecated() && !sourceType.isDeprecated())
362
				modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
361
		} else if (sourceType.isLocalType()) {
363
		} else if (sourceType.isLocalType()) {
362
			if (sourceType.isEnum()) {
364
			if (sourceType.isEnum()) {
363
				problemReporter().illegalLocalTypeDeclaration(referenceContext);
365
				problemReporter().illegalLocalTypeDeclaration(referenceContext);
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-73 / +102 lines)
Lines 409-415 Link Here
409
		}
409
		}
410
410
411
		// force annotations resolution before deciding whether the type may be deprecated
411
		// force annotations resolution before deciding whether the type may be deprecated
412
		refType.initializeDeprecatedAnnotationTagBits();
412
		if ((refType.tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
413
			refType.initializeDeprecatedAnnotationTagBits();
414
		}
413
	
415
	
414
		if (!refType.isViewedAsDeprecated()) return false;
416
		if (!refType.isViewedAsDeprecated()) return false;
415
		
417
		
Lines 475-487 Link Here
475
				case Binding.PACKAGE :
477
				case Binding.PACKAGE :
476
					PackageBinding packageBinding = (PackageBinding) recipient;
478
					PackageBinding packageBinding = (PackageBinding) recipient;
477
					if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
479
					if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
478
					packageBinding.tagBits |= TagBits.AnnotationResolved;
480
					packageBinding.tagBits |= TagBits.AnnotationResolvedMASK;
479
					break;
481
					break;
480
				case Binding.TYPE :
482
				case Binding.TYPE :
481
				case Binding.GENERIC_TYPE :
483
				case Binding.GENERIC_TYPE :
482
					ReferenceBinding type = (ReferenceBinding) recipient;
484
					ReferenceBinding type = (ReferenceBinding) recipient;
483
					if ((type.tagBits & TagBits.AnnotationResolved) != 0) return;
485
					if ((type.tagBits & TagBits.AnnotationResolved) != 0) return;
484
					type.tagBits |= TagBits.AnnotationResolved;
486
					type.tagBits |= TagBits.AnnotationResolvedMASK;
485
					if (length > 0) {
487
					if (length > 0) {
486
						instances = new AnnotationBinding[length];
488
						instances = new AnnotationBinding[length];
487
						type.setAnnotations(instances);
489
						type.setAnnotations(instances);
Lines 490-496 Link Here
490
				case Binding.METHOD :
492
				case Binding.METHOD :
491
					MethodBinding method = (MethodBinding) recipient;
493
					MethodBinding method = (MethodBinding) recipient;
492
					if ((method.tagBits & TagBits.AnnotationResolved) != 0) return;
494
					if ((method.tagBits & TagBits.AnnotationResolved) != 0) return;
493
					method.tagBits |= TagBits.AnnotationResolved;
495
					method.tagBits |= TagBits.AnnotationResolvedMASK;
494
					if (length > 0) {
496
					if (length > 0) {
495
						instances = new AnnotationBinding[length];
497
						instances = new AnnotationBinding[length];
496
						method.setAnnotations(instances);
498
						method.setAnnotations(instances);
Lines 499-505 Link Here
499
				case Binding.FIELD :
501
				case Binding.FIELD :
500
					FieldBinding field = (FieldBinding) recipient;
502
					FieldBinding field = (FieldBinding) recipient;
501
					if ((field.tagBits & TagBits.AnnotationResolved) != 0) return;
503
					if ((field.tagBits & TagBits.AnnotationResolved) != 0) return;
502
					field.tagBits |= TagBits.AnnotationResolved;
504
					field.tagBits |= TagBits.AnnotationResolvedMASK;
503
					if (length > 0) {
505
					if (length > 0) {
504
						instances = new AnnotationBinding[length];
506
						instances = new AnnotationBinding[length];
505
						field.setAnnotations(instances);
507
						field.setAnnotations(instances);
Lines 508-514 Link Here
508
				case Binding.LOCAL :
510
				case Binding.LOCAL :
509
					LocalVariableBinding local = (LocalVariableBinding) recipient;
511
					LocalVariableBinding local = (LocalVariableBinding) recipient;
510
					if ((local.tagBits & TagBits.AnnotationResolved) != 0) return;
512
					if ((local.tagBits & TagBits.AnnotationResolved) != 0) return;
511
					local.tagBits |= TagBits.AnnotationResolved;
513
					local.tagBits |= TagBits.AnnotationResolvedMASK;
512
					if (length > 0) {
514
					if (length > 0) {
513
						instances = new AnnotationBinding[length];
515
						instances = new AnnotationBinding[length];
514
						local.setAnnotations(instances);
516
						local.setAnnotations(instances);
Lines 548-624 Link Here
548
		}
550
		}
549
	}
551
	}
550
	
552
	
551
	/**
553
/**
552
	 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
554
 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
553
	 */
555
 */
554
	public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) {
556
public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) {
555
		if (annotations == null) 
557
	if (recipient != null) {
556
			return;
558
		int kind = recipient.kind();
557
		int length = annotations.length;
559
		if (annotations != null) { 
558
		if (length == 0) 
560
			int length;
559
			return;
561
			if ((length = annotations.length) >= 0) { 
560
		if (recipient != null) {
562
				switch (kind) {
561
			switch (recipient.kind()) {
563
					case Binding.PACKAGE :
562
				case Binding.PACKAGE :
564
						PackageBinding packageBinding = (PackageBinding) recipient;
563
					PackageBinding packageBinding = (PackageBinding) recipient;
565
						if ((packageBinding.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
564
					if ((packageBinding.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
566
						break;
565
					break;
567
					case Binding.TYPE :
566
				case Binding.TYPE :
568
					case Binding.GENERIC_TYPE :
567
				case Binding.GENERIC_TYPE :
569
						ReferenceBinding type = (ReferenceBinding) recipient;
568
					ReferenceBinding type = (ReferenceBinding) recipient;
570
						if ((type.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
569
					if ((type.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
571
						break;
570
					break;
572
					case Binding.METHOD :
571
				case Binding.METHOD :
573
						MethodBinding method = (MethodBinding) recipient;
572
					MethodBinding method = (MethodBinding) recipient;
574
						if ((method.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
573
					if ((method.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
575
						break;
574
					break;
576
					case Binding.FIELD :
575
				case Binding.FIELD :
577
						FieldBinding field = (FieldBinding) recipient;
576
					FieldBinding field = (FieldBinding) recipient;
578
						if ((field.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
577
					if ((field.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
579
						break;
578
					break;
580
					case Binding.LOCAL :
579
				case Binding.LOCAL :
581
						LocalVariableBinding local = (LocalVariableBinding) recipient;
580
					LocalVariableBinding local = (LocalVariableBinding) recipient;
582
						if ((local.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
581
					if ((local.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
583
						break;
582
					break;
584
					default :
583
				default :
585
						return;
584
					return;
586
				}			
585
			}			
587
				for (int i = 0; i < length; i++) {
586
		}
588
					TypeReference annotationTypeRef = annotations[i].type;
587
		for (int i = 0; i < length; i++) {
589
					// only resolve type name if 'Deprecated' last token
588
			TypeReference annotationTypeRef = annotations[i].type;
590
					if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return;
589
			// only resolve type name if 'Deprecated' last token
591
					TypeBinding annotationType = annotations[i].type.resolveType(scope);
590
			if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return;
592
					if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) {
591
			TypeBinding annotationType = annotations[i].type.resolveType(scope);
593
						switch (kind) {
592
			if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) {
594
							case Binding.PACKAGE :
593
				if (recipient != null) {
595
								PackageBinding packageBinding = (PackageBinding) recipient;
594
					switch (recipient.kind()) {
596
								packageBinding.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
595
						case Binding.PACKAGE :
597
								return;
596
							PackageBinding packageBinding = (PackageBinding) recipient;
598
							case Binding.TYPE :
597
							packageBinding.tagBits |= TagBits.AnnotationDeprecated;
599
							case Binding.GENERIC_TYPE :
598
							break;
600
							case Binding.TYPE_PARAMETER :
599
						case Binding.TYPE :
601
								ReferenceBinding type = (ReferenceBinding) recipient;
600
						case Binding.GENERIC_TYPE :
602
								type.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
601
						case Binding.TYPE_PARAMETER :
603
								return;
602
							ReferenceBinding type = (ReferenceBinding) recipient;
604
							case Binding.METHOD :
603
							type.tagBits |= TagBits.AnnotationDeprecated;
605
								MethodBinding method = (MethodBinding) recipient;
604
							break;
606
								method.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
605
						case Binding.METHOD :
607
								return;
606
							MethodBinding method = (MethodBinding) recipient;
608
							case Binding.FIELD :
607
							method.tagBits |= TagBits.AnnotationDeprecated;
609
								FieldBinding field = (FieldBinding) recipient;
608
							break;
610
								field.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
609
						case Binding.FIELD :
611
								return;
610
							FieldBinding field = (FieldBinding) recipient;
612
							case Binding.LOCAL :
611
							field.tagBits |= TagBits.AnnotationDeprecated;
613
								LocalVariableBinding local = (LocalVariableBinding) recipient;
612
							break;
614
								local.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
613
						case Binding.LOCAL :
615
								return;
614
							LocalVariableBinding local = (LocalVariableBinding) recipient;
616
							default:
615
							local.tagBits |= TagBits.AnnotationDeprecated;
617
								return;
616
							break;
618
						}			
617
					}			
619
					}
618
				}
620
				}
619
			}
621
			}
620
		}
622
		}
623
		switch (kind) {
624
			case Binding.PACKAGE :
625
				PackageBinding packageBinding = (PackageBinding) recipient;
626
				packageBinding.tagBits |= TagBits.DeprecatedAnnotationResolved;
627
				return;
628
			case Binding.TYPE :
629
			case Binding.GENERIC_TYPE :
630
			case Binding.TYPE_PARAMETER :
631
				ReferenceBinding type = (ReferenceBinding) recipient;
632
				type.tagBits |= TagBits.DeprecatedAnnotationResolved;
633
				return;
634
			case Binding.METHOD :
635
				MethodBinding method = (MethodBinding) recipient;
636
				method.tagBits |= TagBits.DeprecatedAnnotationResolved;
637
				return;
638
			case Binding.FIELD :
639
				FieldBinding field = (FieldBinding) recipient;
640
				field.tagBits |= TagBits.DeprecatedAnnotationResolved;
641
				return;
642
			case Binding.LOCAL :
643
				LocalVariableBinding local = (LocalVariableBinding) recipient;
644
				local.tagBits |= TagBits.DeprecatedAnnotationResolved;
645
				return;
646
			default:
647
				return;
648
		}			
621
	}
649
	}
650
}
622
	
651
	
623
	public int sourceStart() {
652
	public int sourceStart() {
624
		return this.sourceStart;
653
		return this.sourceStart;

Return to bug 161214