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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
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 (-4 / +4 lines)
Lines 969-990 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
		TypeDeclaration typeDecl = this.scope.referenceContext;
979
		boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
977
		boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
980
		try {
978
		try {
981
			typeDecl.staticInitializerScope.insideTypeAnnotation = true;
979
			typeDecl.staticInitializerScope.insideTypeAnnotation = true;
982
			ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
980
			ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
981
			this.tagBits |= TagBits.DeprecatedAnnotationResolved;
983
		} finally {
982
		} finally {
984
			typeDecl.staticInitializerScope.insideTypeAnnotation = old;
983
			typeDecl.staticInitializerScope.insideTypeAnnotation = old;
985
		}
984
		}
986
		if ((this.tagBits & TagBits.AnnotationDeprecated) != 0)
985
		if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) {
987
			this.modifiers |= ClassFileConstants.AccDeprecated;
986
			this.modifiers |= ClassFileConstants.AccDeprecated;
987
		}
988
	}
988
	}
989
}
989
}
990
990
(-)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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
23
	}
23
	}
24
}
24
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java (-17 / +18 lines)
Lines 77-108 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 AnnotationTarget = ASTNode.Bit35L; // @Target({}) only sets this bit
80
	long DeprecatedAnnotationResolved = ASTNode.Bit35L;
81
	long AnnotationForType = ASTNode.Bit36L;
81
	long AnnotationTarget = ASTNode.Bit36L; // @Target({}) only sets this bit
82
	long AnnotationForField = ASTNode.Bit37L;
82
	long AnnotationForType = ASTNode.Bit37L;
83
	long AnnotationForMethod = ASTNode.Bit38L;
83
	long AnnotationForField = ASTNode.Bit38L;
84
	long AnnotationForParameter = ASTNode.Bit39L;
84
	long AnnotationForMethod = ASTNode.Bit39L;
85
	long AnnotationForConstructor = ASTNode.Bit40L;
85
	long AnnotationForParameter = ASTNode.Bit40L;
86
	long AnnotationForLocalVariable = ASTNode.Bit41L;
86
	long AnnotationForConstructor = ASTNode.Bit41L;
87
	long AnnotationForAnnotationType = ASTNode.Bit42L;
87
	long AnnotationForLocalVariable = ASTNode.Bit42L;
88
	long AnnotationForPackage = ASTNode.Bit43L;
88
	long AnnotationForAnnotationType = ASTNode.Bit43L;
89
	long AnnotationForPackage = ASTNode.Bit44L;
89
	long AnnotationTargetMASK = AnnotationTarget
90
	long AnnotationTargetMASK = AnnotationTarget
90
				| AnnotationForType | AnnotationForField
91
				| AnnotationForType | AnnotationForField
91
				| AnnotationForMethod | AnnotationForParameter
92
				| AnnotationForMethod | AnnotationForParameter
92
				| AnnotationForConstructor | AnnotationForLocalVariable
93
				| AnnotationForConstructor | AnnotationForLocalVariable
93
				| AnnotationForAnnotationType | AnnotationForPackage;
94
				| AnnotationForAnnotationType | AnnotationForPackage;
94
	// 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention
95
	// 2-bits for retention (should check (tagBits & RetentionMask) == RuntimeRetention
95
	long AnnotationSourceRetention = ASTNode.Bit44L;
96
	long AnnotationSourceRetention = ASTNode.Bit45L;
96
	long AnnotationClassRetention = ASTNode.Bit45L;
97
	long AnnotationClassRetention = ASTNode.Bit46L;
97
	long AnnotationRuntimeRetention = AnnotationSourceRetention | AnnotationClassRetention;
98
	long AnnotationRuntimeRetention = AnnotationSourceRetention | AnnotationClassRetention;
98
	long AnnotationRetentionMASK = AnnotationSourceRetention | AnnotationClassRetention | AnnotationRuntimeRetention;
99
	long AnnotationRetentionMASK = AnnotationSourceRetention | AnnotationClassRetention | AnnotationRuntimeRetention;
99
	// marker annotations
100
	// marker annotations
100
	long AnnotationDeprecated = ASTNode.Bit46L;
101
	long AnnotationDeprecated = ASTNode.Bit47L;
101
	long AnnotationDocumented = ASTNode.Bit47L;
102
	long AnnotationDocumented = ASTNode.Bit48L;
102
	long AnnotationInherited = ASTNode.Bit48L;
103
	long AnnotationInherited = ASTNode.Bit49L;
103
	long AnnotationOverride = ASTNode.Bit49L;
104
	long AnnotationOverride = ASTNode.Bit50L;
104
	long AnnotationSuppressWarnings = ASTNode.Bit50L;
105
	long AnnotationSuppressWarnings = ASTNode.Bit51L;
105
	long AllStandardAnnotationsMask = AnnotationTargetMASK | AnnotationRetentionMASK | AnnotationDeprecated | AnnotationDocumented | AnnotationInherited |  AnnotationOverride | AnnotationSuppressWarnings;
106
	long AllStandardAnnotationsMask = AnnotationTargetMASK | AnnotationRetentionMASK | AnnotationDeprecated | AnnotationDocumented | AnnotationInherited |  AnnotationOverride | AnnotationSuppressWarnings;
106
	
107
	
107
	long DefaultValueResolved = ASTNode.Bit51L;
108
	long DefaultValueResolved = ASTNode.Bit52L;
108
}
109
}
(-)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.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
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 (-19 / +15 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-58 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
		super.initializeDeprecatedAnnotationTagBits();
42
		enclosing.initializeDeprecatedAnnotationTagBits();
43
		if ((this.tagBits & TagBits.AnnotationDeprecated) == 0) {
43
		TypeDeclaration typeDecl = this.scope.referenceContext;
44
			// check enclosing type
44
		boolean old = typeDecl.staticInitializerScope.insideTypeAnnotation;
45
			ReferenceBinding enclosing;
45
		try {
46
			if (((enclosing = this.enclosingType()).tagBits & TagBits.DeprecatedAnnotationResolved) == 0) {
46
			typeDecl.staticInitializerScope.insideTypeAnnotation = true;
47
				enclosing.initializeDeprecatedAnnotationTagBits();
47
			ASTNode.resolveDeprecatedAnnotations(typeDecl.staticInitializerScope, typeDecl.annotations, this);
48
			}
48
		} finally {
49
			if (enclosing.isViewedAsDeprecated()) {
49
			typeDecl.staticInitializerScope.insideTypeAnnotation = old;
50
				this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
50
		}
51
			}
51
		if ((this.tagBits & TagBits.AnnotationDeprecated) != 0) {
52
			this.modifiers |= ClassFileConstants.AccDeprecated;
53
		} else if ((enclosing.modifiers & (ClassFileConstants.AccDeprecated |
54
						ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0) {
55
			this.modifiers |= ExtraCompilerModifiers.AccDeprecatedImplicitly;
56
		}
52
		}
57
	}
53
	}
58
}
54
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Binding.java (-1 / +1 lines)
Lines 72-78 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.
77
	 * @see org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding#initializeDeprecatedAnnotationTagBits()
77
	 * @see org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding#initializeDeprecatedAnnotationTagBits()
78
	 */
78
	 */
(-)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 (-72 / +99 lines)
Lines 475-487 Link Here
475
				case Binding.PACKAGE :
475
				case Binding.PACKAGE :
476
					PackageBinding packageBinding = (PackageBinding) recipient;
476
					PackageBinding packageBinding = (PackageBinding) recipient;
477
					if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
477
					if ((packageBinding.tagBits & TagBits.AnnotationResolved) != 0) return;
478
					packageBinding.tagBits |= TagBits.AnnotationResolved;
478
					packageBinding.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
479
					break;
479
					break;
480
				case Binding.TYPE :
480
				case Binding.TYPE :
481
				case Binding.GENERIC_TYPE :
481
				case Binding.GENERIC_TYPE :
482
					ReferenceBinding type = (ReferenceBinding) recipient;
482
					ReferenceBinding type = (ReferenceBinding) recipient;
483
					if ((type.tagBits & TagBits.AnnotationResolved) != 0) return;
483
					if ((type.tagBits & TagBits.AnnotationResolved) != 0) return;
484
					type.tagBits |= TagBits.AnnotationResolved;
484
					type.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
485
					if (length > 0) {
485
					if (length > 0) {
486
						instances = new AnnotationBinding[length];
486
						instances = new AnnotationBinding[length];
487
						type.setAnnotations(instances);
487
						type.setAnnotations(instances);
Lines 490-496 Link Here
490
				case Binding.METHOD :
490
				case Binding.METHOD :
491
					MethodBinding method = (MethodBinding) recipient;
491
					MethodBinding method = (MethodBinding) recipient;
492
					if ((method.tagBits & TagBits.AnnotationResolved) != 0) return;
492
					if ((method.tagBits & TagBits.AnnotationResolved) != 0) return;
493
					method.tagBits |= TagBits.AnnotationResolved;
493
					method.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
494
					if (length > 0) {
494
					if (length > 0) {
495
						instances = new AnnotationBinding[length];
495
						instances = new AnnotationBinding[length];
496
						method.setAnnotations(instances);
496
						method.setAnnotations(instances);
Lines 499-505 Link Here
499
				case Binding.FIELD :
499
				case Binding.FIELD :
500
					FieldBinding field = (FieldBinding) recipient;
500
					FieldBinding field = (FieldBinding) recipient;
501
					if ((field.tagBits & TagBits.AnnotationResolved) != 0) return;
501
					if ((field.tagBits & TagBits.AnnotationResolved) != 0) return;
502
					field.tagBits |= TagBits.AnnotationResolved;
502
					field.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
503
					if (length > 0) {
503
					if (length > 0) {
504
						instances = new AnnotationBinding[length];
504
						instances = new AnnotationBinding[length];
505
						field.setAnnotations(instances);
505
						field.setAnnotations(instances);
Lines 508-514 Link Here
508
				case Binding.LOCAL :
508
				case Binding.LOCAL :
509
					LocalVariableBinding local = (LocalVariableBinding) recipient;
509
					LocalVariableBinding local = (LocalVariableBinding) recipient;
510
					if ((local.tagBits & TagBits.AnnotationResolved) != 0) return;
510
					if ((local.tagBits & TagBits.AnnotationResolved) != 0) return;
511
					local.tagBits |= TagBits.AnnotationResolved;
511
					local.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
512
					if (length > 0) {
512
					if (length > 0) {
513
						instances = new AnnotationBinding[length];
513
						instances = new AnnotationBinding[length];
514
						local.setAnnotations(instances);
514
						local.setAnnotations(instances);
Lines 548-624 Link Here
548
		}
548
		}
549
	}
549
	}
550
	
550
	
551
	/**
551
/**
552
	 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
552
 * Figures if @Deprecated annotation is specified, do not resolve entire annotations.
553
	 */
553
 */
554
	public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) {
554
public static void resolveDeprecatedAnnotations(BlockScope scope, Annotation[] annotations, Binding recipient) {
555
		if (annotations == null) 
555
	if (recipient != null) {
556
			return;
556
		int kind = recipient.kind();
557
		int length = annotations.length;
557
		if (annotations != null) { 
558
		if (length == 0) 
558
			int length;
559
			return;
559
			if ((length = annotations.length) >= 0) { 
560
		if (recipient != null) {
560
				switch (kind) {
561
			switch (recipient.kind()) {
561
					case Binding.PACKAGE :
562
				case Binding.PACKAGE :
562
						PackageBinding packageBinding = (PackageBinding) recipient;
563
					PackageBinding packageBinding = (PackageBinding) recipient;
563
						if ((packageBinding.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
564
					if ((packageBinding.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
564
						break;
565
					break;
565
					case Binding.TYPE :
566
				case Binding.TYPE :
566
					case Binding.GENERIC_TYPE :
567
				case Binding.GENERIC_TYPE :
567
						ReferenceBinding type = (ReferenceBinding) recipient;
568
					ReferenceBinding type = (ReferenceBinding) recipient;
568
						if ((type.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
569
					if ((type.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
569
						break;
570
					break;
570
					case Binding.METHOD :
571
				case Binding.METHOD :
571
						MethodBinding method = (MethodBinding) recipient;
572
					MethodBinding method = (MethodBinding) recipient;
572
						if ((method.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
573
					if ((method.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
573
						break;
574
					break;
574
					case Binding.FIELD :
575
				case Binding.FIELD :
575
						FieldBinding field = (FieldBinding) recipient;
576
					FieldBinding field = (FieldBinding) recipient;
576
						if ((field.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
577
					if ((field.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
577
						break;
578
					break;
578
					case Binding.LOCAL :
579
				case Binding.LOCAL :
579
						LocalVariableBinding local = (LocalVariableBinding) recipient;
580
					LocalVariableBinding local = (LocalVariableBinding) recipient;
580
						if ((local.tagBits & TagBits.DeprecatedAnnotationResolved) != 0) return;
581
					if ((local.tagBits & (TagBits.AnnotationResolved|TagBits.AnnotationDeprecated)) != 0) return;
581
						break;
582
					break;
582
					default :
583
				default :
583
						return;
584
					return;
584
				}			
585
			}			
585
				for (int i = 0; i < length; i++) {
586
		}
586
					TypeReference annotationTypeRef = annotations[i].type;
587
		for (int i = 0; i < length; i++) {
587
					// only resolve type name if 'Deprecated' last token
588
			TypeReference annotationTypeRef = annotations[i].type;
588
					if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return;
589
			// only resolve type name if 'Deprecated' last token
589
					TypeBinding annotationType = annotations[i].type.resolveType(scope);
590
			if (!CharOperation.equals(TypeConstants.JAVA_LANG_DEPRECATED[2], annotationTypeRef.getLastToken())) return;
590
					if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) {
591
			TypeBinding annotationType = annotations[i].type.resolveType(scope);
591
						switch (kind) {
592
			if(annotationType != null && annotationType.isValidBinding() && annotationType.id == TypeIds.T_JavaLangDeprecated) {
592
							case Binding.PACKAGE :
593
				if (recipient != null) {
593
								PackageBinding packageBinding = (PackageBinding) recipient;
594
					switch (recipient.kind()) {
594
								packageBinding.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
595
						case Binding.PACKAGE :
595
								return;
596
							PackageBinding packageBinding = (PackageBinding) recipient;
596
							case Binding.TYPE :
597
							packageBinding.tagBits |= TagBits.AnnotationDeprecated;
597
							case Binding.GENERIC_TYPE :
598
							break;
598
							case Binding.TYPE_PARAMETER :
599
						case Binding.TYPE :
599
								ReferenceBinding type = (ReferenceBinding) recipient;
600
						case Binding.GENERIC_TYPE :
600
								type.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
601
						case Binding.TYPE_PARAMETER :
601
								return;
602
							ReferenceBinding type = (ReferenceBinding) recipient;
602
							case Binding.METHOD :
603
							type.tagBits |= TagBits.AnnotationDeprecated;
603
								MethodBinding method = (MethodBinding) recipient;
604
							break;
604
								method.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
605
						case Binding.METHOD :
605
								return;
606
							MethodBinding method = (MethodBinding) recipient;
606
							case Binding.FIELD :
607
							method.tagBits |= TagBits.AnnotationDeprecated;
607
								FieldBinding field = (FieldBinding) recipient;
608
							break;
608
								field.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
609
						case Binding.FIELD :
609
								return;
610
							FieldBinding field = (FieldBinding) recipient;
610
							case Binding.LOCAL :
611
							field.tagBits |= TagBits.AnnotationDeprecated;
611
								LocalVariableBinding local = (LocalVariableBinding) recipient;
612
							break;
612
								local.tagBits |= (TagBits.AnnotationDeprecated | TagBits.DeprecatedAnnotationResolved);
613
						case Binding.LOCAL :
613
								return;
614
							LocalVariableBinding local = (LocalVariableBinding) recipient;
614
							default:
615
							local.tagBits |= TagBits.AnnotationDeprecated;
615
								return;
616
							break;
616
						}			
617
					}			
617
					}
618
				}
618
				}
619
			}
619
			}
620
		}
620
		}
621
		switch (kind) {
622
			case Binding.PACKAGE :
623
				PackageBinding packageBinding = (PackageBinding) recipient;
624
				packageBinding.tagBits |= TagBits.DeprecatedAnnotationResolved;
625
				return;
626
			case Binding.TYPE :
627
			case Binding.GENERIC_TYPE :
628
			case Binding.TYPE_PARAMETER :
629
				ReferenceBinding type = (ReferenceBinding) recipient;
630
				type.tagBits |= TagBits.DeprecatedAnnotationResolved;
631
				return;
632
			case Binding.METHOD :
633
				MethodBinding method = (MethodBinding) recipient;
634
				method.tagBits |= TagBits.DeprecatedAnnotationResolved;
635
				return;
636
			case Binding.FIELD :
637
				FieldBinding field = (FieldBinding) recipient;
638
				field.tagBits |= TagBits.DeprecatedAnnotationResolved;
639
				return;
640
			case Binding.LOCAL :
641
				LocalVariableBinding local = (LocalVariableBinding) recipient;
642
				local.tagBits |= TagBits.DeprecatedAnnotationResolved;
643
				return;
644
			default:
645
				return;
646
		}			
621
	}
647
	}
648
}
622
	
649
	
623
	public int sourceStart() {
650
	public int sourceStart() {
624
		return this.sourceStart;
651
		return this.sourceStart;

Return to bug 161214