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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java (-4 / +9 lines)
Lines 19-24 Link Here
19
import org.eclipse.jdt.internal.compiler.ASTVisitor;
19
import org.eclipse.jdt.internal.compiler.ASTVisitor;
20
import org.eclipse.jdt.internal.compiler.ClassFile;
20
import org.eclipse.jdt.internal.compiler.ClassFile;
21
import org.eclipse.jdt.internal.compiler.CompilationResult;
21
import org.eclipse.jdt.internal.compiler.CompilationResult;
22
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
22
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
23
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
23
import org.eclipse.jdt.internal.compiler.impl.Constant;
24
import org.eclipse.jdt.internal.compiler.impl.Constant;
24
import org.eclipse.jdt.internal.compiler.impl.IrritantSet;
25
import org.eclipse.jdt.internal.compiler.impl.IrritantSet;
Lines 180-185 Link Here
180
	return this.compilationResult;
181
	return this.compilationResult;
181
}
182
}
182
183
184
public void createPackageInfoType() {
185
	TypeDeclaration declaration = new TypeDeclaration(this.compilationResult);
186
	declaration.name = TypeConstants.PACKAGE_INFO_NAME;
187
	declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface;
188
	declaration.javadoc = this.javadoc;
189
	this.types[0] = declaration; // Assumes the first slot is meant for this type
190
}
191
183
/*
192
/*
184
 * Finds the matching type amoung this compilation unit types.
193
 * Finds the matching type amoung this compilation unit types.
185
 * Returns null if no type with this name is found.
194
 * Returns null if no type with this name is found.
Lines 493-502 Link Here
493
			syntheticTypeDeclaration.javadoc = new Javadoc(syntheticTypeDeclaration.declarationSourceStart, syntheticTypeDeclaration.declarationSourceStart);
502
			syntheticTypeDeclaration.javadoc = new Javadoc(syntheticTypeDeclaration.declarationSourceStart, syntheticTypeDeclaration.declarationSourceStart);
494
		}
503
		}
495
		syntheticTypeDeclaration.resolve(this.scope);
504
		syntheticTypeDeclaration.resolve(this.scope);
496
		// resolve annotations if any, skip this step if we don't have a valid scope due to an earlier error. (bug 252555)
497
		if (this.currentPackage!= null && this.currentPackage.annotations != null && syntheticTypeDeclaration.staticInitializerScope != null) {
498
			resolveAnnotations(syntheticTypeDeclaration.staticInitializerScope, this.currentPackage.annotations, this.scope.fPackage);
499
		}
500
		/*
505
		/*
501
		 * resolve javadoc package if any, skip this step if we don't have a valid scope due to an earlier error (bug 252555)
506
		 * resolve javadoc package if any, skip this step if we don't have a valid scope due to an earlier error (bug 252555)
502
		 * we do it now as the javadoc in the fake type won't be resolved. The peculiar usage of MethodScope to resolve the
507
		 * we do it now as the javadoc in the fake type won't be resolved. The peculiar usage of MethodScope to resolve the
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/PackageBinding.java (+19 lines)
Lines 205-210 Link Here
205
	return null;
205
	return null;
206
}
206
}
207
207
208
/**
209
 * Compute the tagbits for standard annotations. For source types, these could require
210
 * lazily resolving corresponding annotation nodes, in case of forward references.
211
 * @see org.eclipse.jdt.internal.compiler.lookup.Binding#getAnnotationTagBits()
212
 */
213
public long getAnnotationTagBits() {
214
	if ((this.tagBits & TagBits.AnnotationResolved) != 0)
215
		return this.tagBits;
216
217
	this.tagBits |= (TagBits.AnnotationResolved | TagBits.DeprecatedAnnotationResolved);
218
	if (this.compoundName == CharOperation.NO_CHAR_CHAR)
219
		return this.tagBits;
220
221
	ReferenceBinding packageInfo = this.getType(TypeConstants.PACKAGE_INFO_NAME);
222
	if (packageInfo != null)
223
		this.tagBits |= (packageInfo.getAnnotationTagBits() & TagBits.AllStandardAnnotationsMask);
224
	return this.tagBits;
225
}
226
208
/* API
227
/* API
209
* Answer the receiver's binding type from Binding.BindingID.
228
* Answer the receiver's binding type from Binding.BindingID.
210
*/
229
*/
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java (-1 / +1 lines)
Lines 1175-1181 Link Here
1175
 */
1175
 */
1176
public final boolean isViewedAsDeprecated() {
1176
public final boolean isViewedAsDeprecated() {
1177
	return (this.modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0
1177
	return (this.modifiers & (ClassFileConstants.AccDeprecated | ExtraCompilerModifiers.AccDeprecatedImplicitly)) != 0
1178
			|| (getPackage().tagBits & TagBits.AnnotationDeprecated) != 0;
1178
			|| (getPackage().getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0;
1179
}
1179
}
1180
1180
1181
public ReferenceBinding[] memberTypes() {
1181
public ReferenceBinding[] memberTypes() {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/CompilationUnitScope.java (-4 / +1 lines)
Lines 94-103 Link Here
94
			// resolve package annotations now if this is "package-info.java".
94
			// resolve package annotations now if this is "package-info.java".
95
			if (this.referenceContext.types == null || this.referenceContext.types.length == 0) {
95
			if (this.referenceContext.types == null || this.referenceContext.types.length == 0) {
96
				this.referenceContext.types = new TypeDeclaration[1];
96
				this.referenceContext.types = new TypeDeclaration[1];
97
				TypeDeclaration declaration = new TypeDeclaration(this.referenceContext.compilationResult);
97
				this.referenceContext.createPackageInfoType();
98
				this.referenceContext.types[0] = declaration;
99
				declaration.name = TypeConstants.PACKAGE_INFO_NAME;
100
				declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface;
101
				firstIsSynthetic = true;
98
				firstIsSynthetic = true;
102
			}
99
			}
103
			// ensure the package annotations are copied over before resolution
100
			// ensure the package annotations are copied over before resolution
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-8 / +7 lines)
Lines 2937-2952 Link Here
2937
					MethodBinding context = ((AbstractMethodDeclaration)methodScope.referenceContext).binding;
2937
					MethodBinding context = ((AbstractMethodDeclaration)methodScope.referenceContext).binding;
2938
					if (context != null && context.isViewedAsDeprecated())
2938
					if (context != null && context.isViewedAsDeprecated())
2939
						return true;
2939
						return true;
2940
				} else {
2940
				} else if (methodScope.initializedField != null && methodScope.initializedField.isViewedAsDeprecated()) {
2941
					SourceTypeBinding type = ((BlockScope)this).referenceType().binding;
2942
					// inside field declaration ? check field modifier to see if deprecated
2941
					// inside field declaration ? check field modifier to see if deprecated
2943
					if (methodScope.initializedField != null && methodScope.initializedField.isViewedAsDeprecated())
2942
					return true;
2943
				}
2944
				SourceTypeBinding declaringType = ((BlockScope)this).referenceType().binding;
2945
				if (declaringType != null) {
2946
					declaringType.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2947
					if (declaringType.isViewedAsDeprecated())
2944
						return true;
2948
						return true;
2945
					if (type != null) {
2946
						type.initializeDeprecatedAnnotationTagBits(); // may not have been resolved until then
2947
						if (type.isViewedAsDeprecated())
2948
							return true;
2949
					}
2950
				}
2949
				}
2951
				break;
2950
				break;
2952
			case Scope.CLASS_SCOPE :
2951
			case Scope.CLASS_SCOPE :
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-18 / +3 lines)
Lines 2831-2842 Link Here
2831
	// nothing to do by default
2831
	// nothing to do by default
2832
	if (this.compilationUnit.isPackageInfo()) {
2832
	if (this.compilationUnit.isPackageInfo()) {
2833
		this.compilationUnit.types = new TypeDeclaration[1];
2833
		this.compilationUnit.types = new TypeDeclaration[1];
2834
		// create a fake interface declaration
2834
		this.compilationUnit.createPackageInfoType();
2835
		TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult);
2836
		declaration.name = TypeConstants.PACKAGE_INFO_NAME;
2837
		declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface;
2838
		this.compilationUnit.types[0] = declaration;
2839
		declaration.javadoc = this.compilationUnit.javadoc;
2840
	}
2835
	}
2841
}
2836
}
2842
protected void consumeEmptyMemberValueArrayInitializer() {
2837
protected void consumeEmptyMemberValueArrayInitializer() {
Lines 4040-4051 Link Here
4040
	// InternalCompilationUnit ::= ImportDeclarations ReduceImports
4035
	// InternalCompilationUnit ::= ImportDeclarations ReduceImports
4041
	if (this.compilationUnit.isPackageInfo()) {
4036
	if (this.compilationUnit.isPackageInfo()) {
4042
		this.compilationUnit.types = new TypeDeclaration[1];
4037
		this.compilationUnit.types = new TypeDeclaration[1];
4043
		// create a fake interface declaration
4038
		this.compilationUnit.createPackageInfoType();
4044
		TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult);
4045
		declaration.name = TypeConstants.PACKAGE_INFO_NAME;
4046
		declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface;
4047
		this.compilationUnit.types[0] = declaration;
4048
		declaration.javadoc = this.compilationUnit.javadoc;
4049
	}
4039
	}
4050
}
4040
}
4051
protected void consumeInternalCompilationUnitWithTypes() {
4041
protected void consumeInternalCompilationUnitWithTypes() {
Lines 4060-4071 Link Here
4060
			this.compilationUnit.types = new TypeDeclaration[length + 1];
4050
			this.compilationUnit.types = new TypeDeclaration[length + 1];
4061
			this.astPtr -= length;
4051
			this.astPtr -= length;
4062
			System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types, 1, length);
4052
			System.arraycopy(this.astStack, this.astPtr + 1, this.compilationUnit.types, 1, length);
4063
			// create a fake interface declaration
4053
			this.compilationUnit.createPackageInfoType();
4064
			TypeDeclaration declaration = new TypeDeclaration(this.compilationUnit.compilationResult);
4065
			declaration.name = TypeConstants.PACKAGE_INFO_NAME;
4066
			declaration.modifiers = ClassFileConstants.AccDefault | ClassFileConstants.AccInterface;
4067
			this.compilationUnit.types[0] = declaration;
4068
			declaration.javadoc = this.compilationUnit.javadoc;
4069
		} else {
4054
		} else {
4070
			this.compilationUnit.types = new TypeDeclaration[length];
4055
			this.compilationUnit.types = new TypeDeclaration[length];
4071
			this.astPtr -= length;
4056
			this.astPtr -= length;
(-)model/org/eclipse/jdt/internal/core/builder/IncrementalImageBuilder.java (+3 lines)
Lines 17-22 Link Here
17
import org.eclipse.jdt.core.compiler.*;
17
import org.eclipse.jdt.core.compiler.*;
18
import org.eclipse.jdt.internal.compiler.*;
18
import org.eclipse.jdt.internal.compiler.*;
19
import org.eclipse.jdt.internal.compiler.classfmt.*;
19
import org.eclipse.jdt.internal.compiler.classfmt.*;
20
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
20
import org.eclipse.jdt.internal.compiler.problem.*;
21
import org.eclipse.jdt.internal.compiler.problem.*;
21
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
22
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
22
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
23
import org.eclipse.jdt.internal.compiler.util.SuffixConstants;
Lines 575-580 Link Here
575
			if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(resourceName)) {
576
			if (org.eclipse.jdt.internal.core.util.Util.isJavaLikeFileName(resourceName)) {
576
				IPath typePath = resource.getFullPath().removeFirstSegments(segmentCount).removeFileExtension();
577
				IPath typePath = resource.getFullPath().removeFirstSegments(segmentCount).removeFileExtension();
577
				String typeLocator = resource.getProjectRelativePath().toString();
578
				String typeLocator = resource.getProjectRelativePath().toString();
579
				if (CharOperation.equals(typePath.lastSegment().toCharArray(), TypeConstants.PACKAGE_INFO_NAME))
580
					addDependentsOf(typePath.removeLastSegments(1) , false); // indict the package since the package-info file is changed
578
				switch (sourceDelta.getKind()) {
581
				switch (sourceDelta.getKind()) {
579
					case IResourceDelta.ADDED :
582
					case IResourceDelta.ADDED :
580
						if (JavaBuilder.DEBUG)
583
						if (JavaBuilder.DEBUG)

Return to bug 214948