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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java (-4 / +9 lines)
Lines 664-669 Link Here
664
						this.tagBits |= TagBits.HasDirectWildcard;
664
						this.tagBits |= TagBits.HasDirectWildcard;
665
						if (((WildcardBinding) someArgument).boundKind != Wildcard.UNBOUND) {
665
						if (((WildcardBinding) someArgument).boundKind != Wildcard.UNBOUND) {
666
							this.tagBits |= TagBits.IsBoundParameterizedType;
666
							this.tagBits |= TagBits.IsBoundParameterizedType;
667
							this.tagBits |= someArgument.tagBits & TagBits.ContainsNestedTypes;
667
						}
668
						}
668
						break;
669
						break;
669
					case Binding.INTERSECTION_TYPE :
670
					case Binding.INTERSECTION_TYPE :
Lines 673-682 Link Here
673
						this.tagBits |= TagBits.IsBoundParameterizedType;
674
						this.tagBits |= TagBits.IsBoundParameterizedType;
674
						break;
675
						break;
675
				}
676
				}
676
			    this.tagBits |= someArgument.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
677
				this.tagBits |= someArgument.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
677
			}
678
			}
678
		}
679
		}
679
		this.tagBits |= someType.tagBits & (TagBits.IsLocalType| TagBits.IsMemberType | TagBits.IsNestedType | TagBits.HasMissingType);
680
		this.tagBits |= someType.tagBits & (TagBits.IsLocalType| TagBits.IsMemberType | TagBits.IsNestedType | TagBits.HasMissingType | TagBits.ContainsNestedTypes);
680
		this.tagBits &= ~(TagBits.AreFieldsComplete|TagBits.AreMethodsComplete);
681
		this.tagBits &= ~(TagBits.AreFieldsComplete|TagBits.AreMethodsComplete);
681
	}
682
	}
682
683
Lines 845-854 Link Here
845
846
846
		this.tagBits &= ~TagBits.HasUnresolvedTypeVariables; // can be recursive so only want to call once
847
		this.tagBits &= ~TagBits.HasUnresolvedTypeVariables; // can be recursive so only want to call once
847
		ReferenceBinding resolvedType = (ReferenceBinding) BinaryTypeBinding.resolveType(this.type, this.environment, false /* no raw conversion */); // still part of parameterized type ref
848
		ReferenceBinding resolvedType = (ReferenceBinding) BinaryTypeBinding.resolveType(this.type, this.environment, false /* no raw conversion */); // still part of parameterized type ref
849
		this.tagBits |= resolvedType.tagBits & TagBits.ContainsNestedTypes;
848
		if (this.arguments != null) {
850
		if (this.arguments != null) {
849
			int argLength = this.arguments.length;
851
			int argLength = this.arguments.length;
850
			for (int i = 0; i < argLength; i++)
852
			for (int i = 0; i < argLength; i++) {
851
				this.arguments[i] = BinaryTypeBinding.resolveType(this.arguments[i], this.environment, true /* raw conversion */);
853
				TypeBinding resolveType = BinaryTypeBinding.resolveType(this.arguments[i], this.environment, true /* raw conversion */);
854
				this.arguments[i] = resolveType;
855
				this.tagBits |= resolvedType.tagBits & TagBits.ContainsNestedTypes;
856
			}
852
			// arity check
857
			// arity check
853
			TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables();
858
			TypeVariableBinding[] refTypeVariables = resolvedType.typeVariables();
854
			if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
859
			if (refTypeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (+2 lines)
Lines 621-626 Link Here
621
					} else {
621
					} else {
622
						typeVariable.superInterfaces = new ReferenceBinding[] {superRefType};
622
						typeVariable.superInterfaces = new ReferenceBinding[] {superRefType};
623
					}
623
					}
624
					typeVariable.tagBits |= superType.tagBits & TagBits.ContainsNestedTypes;
624
					typeVariable.firstBound = superRefType; // first bound used to compute erasure
625
					typeVariable.firstBound = superRefType; // first bound used to compute erasure
625
				}
626
				}
626
			}
627
			}
Lines 635-640 Link Here
635
						typeVariable.tagBits |= TagBits.HierarchyHasProblems;
636
						typeVariable.tagBits |= TagBits.HierarchyHasProblems;
636
						continue nextBound;
637
						continue nextBound;
637
					} else {
638
					} else {
639
						typeVariable.tagBits |= superType.tagBits & TagBits.ContainsNestedTypes;
638
						boolean didAlreadyComplain = !typeRef.resolvedType.isValidBinding();
640
						boolean didAlreadyComplain = !typeRef.resolvedType.isValidBinding();
639
						if (isFirstBoundTypeVariable && j == 0) {
641
						if (isFirstBoundTypeVariable && j == 0) {
640
							problemReporter().noAdditionalBoundAfterTypeVariable(typeRef);
642
							problemReporter().noAdditionalBoundAfterTypeVariable(typeRef);
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ArrayBinding.java (-1 / +1 lines)
Lines 35-41 Link Here
35
	if (type instanceof UnresolvedReferenceBinding)
35
	if (type instanceof UnresolvedReferenceBinding)
36
		((UnresolvedReferenceBinding) type).addWrapper(this, environment);
36
		((UnresolvedReferenceBinding) type).addWrapper(this, environment);
37
	else
37
	else
38
    	this.tagBits |= type.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard | TagBits.HasMissingType);
38
		this.tagBits |= type.tagBits & (TagBits.HasTypeVariable | TagBits.HasDirectWildcard | TagBits.HasMissingType | TagBits.ContainsNestedTypes);
39
}
39
}
40
40
41
public TypeBinding closestMatch() {
41
public TypeBinding closestMatch() {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TypeVariableBinding.java (-3 / +8 lines)
Lines 398-411 Link Here
398
			return this;
398
			return this;
399
399
400
		TypeBinding oldSuperclass = this.superclass, oldFirstInterface = null;
400
		TypeBinding oldSuperclass = this.superclass, oldFirstInterface = null;
401
		if (this.superclass != null)
401
		if (this.superclass != null) {
402
			this.superclass = (ReferenceBinding) BinaryTypeBinding.resolveType(this.superclass, this.environment, true /* raw conversion */);
402
			ReferenceBinding resolveType = (ReferenceBinding) BinaryTypeBinding.resolveType(this.superclass, this.environment, true /* raw conversion */);
403
			this.tagBits |= resolveType.tagBits & TagBits.ContainsNestedTypes;
404
			this.superclass = resolveType;
405
		}
403
		ReferenceBinding[] interfaces = this.superInterfaces;
406
		ReferenceBinding[] interfaces = this.superInterfaces;
404
		int length;
407
		int length;
405
		if ((length = interfaces.length) != 0) {
408
		if ((length = interfaces.length) != 0) {
406
			oldFirstInterface = interfaces[0];
409
			oldFirstInterface = interfaces[0];
407
			for (int i = length; --i >= 0;) {
410
			for (int i = length; --i >= 0;) {
408
				interfaces[i] = (ReferenceBinding) BinaryTypeBinding.resolveType(interfaces[i], this.environment, true /* raw conversion */);
411
				ReferenceBinding resolveType = (ReferenceBinding) BinaryTypeBinding.resolveType(interfaces[i], this.environment, true /* raw conversion */);
412
				this.tagBits |= resolveType.tagBits & TagBits.ContainsNestedTypes;
413
				interfaces[i] = resolveType;
409
			}
414
			}
410
		}
415
		}
411
		// refresh the firstBound in case it changed
416
		// refresh the firstBound in case it changed
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodBinding.java (-23 / +64 lines)
Lines 962-968 Link Here
962
 */
962
 */
963
public final char[] signature(ClassFile classFile) {
963
public final char[] signature(ClassFile classFile) {
964
	if (this.signature != null) {
964
	if (this.signature != null) {
965
		if ((this.tagBits & TagBits.ContainsNestedTypesInSignature) != 0) {
965
		if ((this.tagBits & TagBits.ContainsNestedTypes) != 0) {
966
			// we need to record inner classes references
966
			// we need to record inner classes references
967
			boolean isConstructor = isConstructor();
967
			boolean isConstructor = isConstructor();
968
			TypeBinding[] targetParameters = this.parameters;
968
			TypeBinding[] targetParameters = this.parameters;
Lines 973-980 Link Here
973
				if (syntheticArgumentTypes != null) {
973
				if (syntheticArgumentTypes != null) {
974
					for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
974
					for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
975
						ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
975
						ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
976
						if (syntheticArgumentType.isNestedType()) {
976
						if ((syntheticArgumentType.tagBits & TagBits.ContainsNestedTypes) != 0) {
977
							classFile.recordInnerClasses(syntheticArgumentType);
977
							recordNestedType(classFile, syntheticArgumentType);
978
						}
978
						}
979
					}
979
					}
980
				}
980
				}
Lines 984-994 Link Here
984
			}
984
			}
985
985
986
			if (targetParameters != Binding.NO_PARAMETERS) {
986
			if (targetParameters != Binding.NO_PARAMETERS) {
987
				for (int i = 0; i < targetParameters.length; i++) {
987
				for (int i = 0, max = targetParameters.length; i < max; i++) {
988
					TypeBinding targetParameter = targetParameters[i];
988
					TypeBinding targetParameter = targetParameters[i];
989
					TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
989
					TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
990
					if (leafTargetParameterType.isNestedType()) {
990
					if ((leafTargetParameterType.tagBits & TagBits.ContainsNestedTypes) != 0) {
991
						classFile.recordInnerClasses(leafTargetParameterType);
991
						recordNestedType(classFile, leafTargetParameterType);
992
					}
992
					}
993
				}
993
				}
994
			}
994
			}
Lines 997-1011 Link Here
997
				for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
997
				for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
998
					TypeBinding parameter = this.parameters[i];
998
					TypeBinding parameter = this.parameters[i];
999
					TypeBinding leafParameterType = parameter.leafComponentType();
999
					TypeBinding leafParameterType = parameter.leafComponentType();
1000
					if (leafParameterType.isNestedType()) {
1000
					if ((leafParameterType.tagBits & TagBits.ContainsNestedTypes) != 0) {
1001
						classFile.recordInnerClasses(leafParameterType);
1001
						recordNestedType(classFile, leafParameterType);
1002
					}
1002
					}
1003
				}
1003
				}
1004
			}
1004
			}
1005
			if (this.returnType != null) {
1005
			if (this.returnType != null) {
1006
				TypeBinding ret = this.returnType.leafComponentType();
1006
				TypeBinding ret = this.returnType.leafComponentType();
1007
				if (ret.isNestedType()) {
1007
				if ((ret.tagBits & TagBits.ContainsNestedTypes) != 0) {
1008
					classFile.recordInnerClasses(ret);
1008
					recordNestedType(classFile, ret);
1009
				}
1009
				}
1010
			}
1010
			}
1011
		}
1011
		}
Lines 1028-1036 Link Here
1028
		if (syntheticArgumentTypes != null) {
1028
		if (syntheticArgumentTypes != null) {
1029
			for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
1029
			for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
1030
				ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
1030
				ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
1031
				if (syntheticArgumentType.isNestedType()) {
1031
				if ((syntheticArgumentType.tagBits & TagBits.ContainsNestedTypes) != 0) {
1032
					this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1032
					recordNestedType(classFile, syntheticArgumentType);
1033
					classFile.recordInnerClasses(syntheticArgumentType);
1034
				}
1033
				}
1035
				buffer.append(syntheticArgumentType.signature());
1034
				buffer.append(syntheticArgumentType.signature());
1036
			}
1035
			}
Lines 1042-1053 Link Here
1042
	}
1041
	}
1043
1042
1044
	if (targetParameters != Binding.NO_PARAMETERS) {
1043
	if (targetParameters != Binding.NO_PARAMETERS) {
1045
		for (int i = 0; i < targetParameters.length; i++) {
1044
		for (int i = 0, max = targetParameters.length; i < max; i++) {
1046
			TypeBinding targetParameter = targetParameters[i];
1045
			TypeBinding targetParameter = targetParameters[i];
1047
			TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
1046
			TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
1048
			if (leafTargetParameterType.isNestedType()) {
1047
			if ((leafTargetParameterType.tagBits & TagBits.ContainsNestedTypes) != 0) {
1049
				this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1048
				recordNestedType(classFile, leafTargetParameterType);
1050
				classFile.recordInnerClasses(leafTargetParameterType);
1051
			}
1049
			}
1052
			buffer.append(targetParameter.signature());
1050
			buffer.append(targetParameter.signature());
1053
		}
1051
		}
Lines 1062-1070 Link Here
1062
		for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
1060
		for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
1063
			TypeBinding parameter = this.parameters[i];
1061
			TypeBinding parameter = this.parameters[i];
1064
			TypeBinding leafParameterType = parameter.leafComponentType();
1062
			TypeBinding leafParameterType = parameter.leafComponentType();
1065
			if (leafParameterType.isNestedType()) {
1063
			if ((leafParameterType.tagBits & TagBits.ContainsNestedTypes) != 0) {
1066
				this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1064
				recordNestedType(classFile, leafParameterType);
1067
				classFile.recordInnerClasses(leafParameterType);
1068
			}
1065
			}
1069
			buffer.append(parameter.signature());
1066
			buffer.append(parameter.signature());
1070
		}
1067
		}
Lines 1072-1080 Link Here
1072
	buffer.append(')');
1069
	buffer.append(')');
1073
	if (this.returnType != null) {
1070
	if (this.returnType != null) {
1074
		TypeBinding ret = this.returnType.leafComponentType();
1071
		TypeBinding ret = this.returnType.leafComponentType();
1075
		if (ret.isNestedType()) {
1072
		if ((ret.tagBits & TagBits.ContainsNestedTypes) != 0) {
1076
			this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1073
			recordNestedType(classFile, ret);
1077
			classFile.recordInnerClasses(ret);
1078
		}
1074
		}
1079
		buffer.append(this.returnType.signature());
1075
		buffer.append(this.returnType.signature());
1080
	}
1076
	}
Lines 1084-1089 Link Here
1084
1080
1085
	return this.signature;
1081
	return this.signature;
1086
}
1082
}
1083
private void recordNestedType(ClassFile classFile, TypeBinding typeBinding) {
1084
	if (typeBinding.isNestedType()) {
1085
		this.tagBits |= TagBits.ContainsNestedTypes;
1086
		classFile.recordInnerClasses(typeBinding);
1087
	} else if (typeBinding.isParameterizedType()
1088
			&& ((typeBinding.tagBits & TagBits.ContainsNestedTypes) != 0)) {
1089
		ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) typeBinding;
1090
		TypeBinding[] arguments = parameterizedTypeBinding.arguments;
1091
		for (int j = 0, max2 = arguments.length; j < max2; j++) {
1092
			TypeBinding argument = arguments[j];
1093
			if (argument.isWildcard()) {
1094
				WildcardBinding wildcardBinding = (WildcardBinding) argument;
1095
				TypeBinding bound = wildcardBinding.bound;
1096
				if (bound != null) {
1097
					recordNestedType(classFile, bound);
1098
				}
1099
				ReferenceBinding superclass = wildcardBinding.superclass();
1100
				if (superclass != null) {
1101
					recordNestedType(classFile, superclass);
1102
				}
1103
				ReferenceBinding[] superInterfaces = wildcardBinding.superInterfaces();
1104
				if (superInterfaces != null) {
1105
					for (int k = 0, max3 =  superInterfaces.length; k < max3; k++) {
1106
						ReferenceBinding superInterface = superInterfaces[k];
1107
						recordNestedType(classFile, superInterface);
1108
					}
1109
				}
1110
			} else {
1111
				recordNestedType(classFile, argument);
1112
			}
1113
		}
1114
	} else if (typeBinding.isTypeVariable()
1115
			&& ((typeBinding.tagBits & TagBits.ContainsNestedTypes) != 0)) {
1116
		TypeVariableBinding typeVariableBinding = (TypeVariableBinding) typeBinding;
1117
		ReferenceBinding superclass = typeVariableBinding.superclass();
1118
		recordNestedType(classFile, superclass);
1119
		ReferenceBinding[] superInterfaces = typeVariableBinding.superInterfaces();
1120
		if (superInterfaces != null) {
1121
			for (int k = 0, max3 = superInterfaces.length; k < max3; k++) {
1122
				ReferenceBinding superInterface = superInterfaces[k];
1123
				recordNestedType(classFile, superInterface);
1124
			}
1125
		}
1126
	}
1127
}
1087
public final int sourceEnd() {
1128
public final int sourceEnd() {
1088
	AbstractMethodDeclaration method = sourceMethod();
1129
	AbstractMethodDeclaration method = sourceMethod();
1089
	if (method == null) {
1130
	if (method == null) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/NestedTypeBinding.java (-1 / +1 lines)
Lines 21-27 Link Here
21
21
22
public NestedTypeBinding(char[][] typeName, ClassScope scope, SourceTypeBinding enclosingType) {
22
public NestedTypeBinding(char[][] typeName, ClassScope scope, SourceTypeBinding enclosingType) {
23
	super(typeName, enclosingType.fPackage, scope);
23
	super(typeName, enclosingType.fPackage, scope);
24
	this.tagBits |= TagBits.IsNestedType;
24
	this.tagBits |= (TagBits.IsNestedType | TagBits.ContainsNestedTypes);
25
	this.enclosingType = enclosingType;
25
	this.enclosingType = enclosingType;
26
}
26
}
27
27
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java (-4 / +5 lines)
Lines 19-29 Link Here
19
	long IsBaseType = ASTNode.Bit2;
19
	long IsBaseType = ASTNode.Bit2;
20
	long IsNestedType = ASTNode.Bit3;
20
	long IsNestedType = ASTNode.Bit3;
21
	long IsMemberType = ASTNode.Bit4;
21
	long IsMemberType = ASTNode.Bit4;
22
	long MemberTypeMask = IsNestedType | IsMemberType;
22
	long ContainsNestedTypes = ASTNode.Bit12; // method/parameterized type binding
23
	long MemberTypeMask = IsNestedType | IsMemberType | ContainsNestedTypes;
23
	long IsLocalType = ASTNode.Bit5;
24
	long IsLocalType = ASTNode.Bit5;
24
	long LocalTypeMask = IsNestedType | IsLocalType;
25
	long LocalTypeMask = IsNestedType | IsLocalType | ContainsNestedTypes;
25
	long IsAnonymousType = ASTNode.Bit6;
26
	long IsAnonymousType = ASTNode.Bit6;
26
	long AnonymousTypeMask = LocalTypeMask | IsAnonymousType;
27
	long AnonymousTypeMask = LocalTypeMask | IsAnonymousType | ContainsNestedTypes;
27
	long IsBinaryBinding = ASTNode.Bit7;
28
	long IsBinaryBinding = ASTNode.Bit7;
28
29
29
	// set for all bindings either represeting a missing type (type), or directly referencing a missing type (field/method/variable)
30
	// set for all bindings either represeting a missing type (type), or directly referencing a missing type (field/method/variable)
Lines 35-43 Link Here
35
	// for the type cycle hierarchy check used by ClassScope
36
	// for the type cycle hierarchy check used by ClassScope
36
	long BeginHierarchyCheck = ASTNode.Bit9;  // type
37
	long BeginHierarchyCheck = ASTNode.Bit9;  // type
37
	long EndHierarchyCheck = ASTNode.Bit10; // type
38
	long EndHierarchyCheck = ASTNode.Bit10; // type
38
	long ContainsNestedTypesInSignature = ASTNode.Bit10; // method
39
	long HasParameterAnnotations = ASTNode.Bit11; // method
39
	long HasParameterAnnotations = ASTNode.Bit11; // method
40
40
41
41
	// test bit to see if default abstract methods were computed
42
	// test bit to see if default abstract methods were computed
42
	long KnowsDefaultAbstractMethods = ASTNode.Bit11; // type
43
	long KnowsDefaultAbstractMethods = ASTNode.Bit11; // type
43
44
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/WildcardBinding.java (-12 / +30 lines)
Lines 39-45 Link Here
39
	 */
39
	 */
40
	public WildcardBinding(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind, LookupEnvironment environment) {
40
	public WildcardBinding(ReferenceBinding genericType, int rank, TypeBinding bound, TypeBinding[] otherBounds, int boundKind, LookupEnvironment environment) {
41
		this.rank = rank;
41
		this.rank = rank;
42
	    this.boundKind = boundKind;
42
		this.boundKind = boundKind;
43
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat wildcard as public
43
		this.modifiers = ClassFileConstants.AccPublic | ExtraCompilerModifiers.AccGenericSignature; // treat wildcard as public
44
		this.environment = environment;
44
		this.environment = environment;
45
		initialize(genericType, bound, otherBounds);
45
		initialize(genericType, bound, otherBounds);
Lines 53-59 Link Here
53
			((UnresolvedReferenceBinding) genericType).addWrapper(this, environment);
53
			((UnresolvedReferenceBinding) genericType).addWrapper(this, environment);
54
		if (bound instanceof UnresolvedReferenceBinding)
54
		if (bound instanceof UnresolvedReferenceBinding)
55
			((UnresolvedReferenceBinding) bound).addWrapper(this, environment);
55
			((UnresolvedReferenceBinding) bound).addWrapper(this, environment);
56
		this.tagBits |=  TagBits.HasUnresolvedTypeVariables; // cleared in resolve()
56
		this.tagBits |= TagBits.HasUnresolvedTypeVariables; // cleared in resolve()
57
	}
57
	}
58
58
59
	public int kind() {
59
	public int kind() {
Lines 425-431 Link Here
425
			this.fPackage = someGenericType.getPackage();
425
			this.fPackage = someGenericType.getPackage();
426
		}
426
		}
427
		if (someBound != null) {
427
		if (someBound != null) {
428
			this.tagBits |= someBound.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
428
			this.tagBits |= someBound.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType | TagBits.ContainsNestedTypes);
429
		}
430
		if (someOtherBounds != null) {
431
			for (int i = 0, max = someOtherBounds.length; i < max; i++) {
432
				TypeBinding someOtherBound = someOtherBounds[i];
433
				this.tagBits |= someOtherBound.tagBits & TagBits.ContainsNestedTypes;
434
			}
429
		}
435
		}
430
	}
436
	}
431
437
Lines 494-511 Link Here
494
500
495
		this.tagBits &= ~TagBits.HasUnresolvedTypeVariables;
501
		this.tagBits &= ~TagBits.HasUnresolvedTypeVariables;
496
		BinaryTypeBinding.resolveType(this.genericType, this.environment, false /* no raw conversion */);
502
		BinaryTypeBinding.resolveType(this.genericType, this.environment, false /* no raw conversion */);
497
	    switch(this.boundKind) {
503
		switch(this.boundKind) {
498
	        case Wildcard.EXTENDS :
504
			case Wildcard.EXTENDS :
499
				this.bound = BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */);
505
				TypeBinding resolveType = BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */);
500
	        	for (int i = 0, length = this.otherBounds == null ? 0 : this.otherBounds.length; i < length; i++) {
506
				this.bound = resolveType;
501
					this.otherBounds[i]= BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */);
507
				if (resolveType.isNestedType() || ((resolveType.tagBits & TagBits.ContainsNestedTypes) != 0)) {
502
	        	}
508
					this.tagBits |= TagBits.ContainsNestedTypes;
509
				}
510
				for (int i = 0, length = this.otherBounds == null ? 0 : this.otherBounds.length; i < length; i++) {
511
					resolveType = BinaryTypeBinding.resolveType(this.otherBounds[i], this.environment, true /* raw conversion */);
512
					this.otherBounds[i]= resolveType;
513
					if (resolveType.isNestedType() || ((resolveType.tagBits & TagBits.ContainsNestedTypes) != 0)) {
514
						this.tagBits |= TagBits.ContainsNestedTypes;
515
					}
516
				}
503
				break;
517
				break;
504
	        case Wildcard.SUPER :
518
			case Wildcard.SUPER :
505
				this.bound = BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */);
519
				resolveType = BinaryTypeBinding.resolveType(this.bound, this.environment, true /* raw conversion */);
520
				this.bound = resolveType;
521
				if (resolveType.isNestedType() || ((resolveType.tagBits & TagBits.ContainsNestedTypes) != 0)) {
522
					this.tagBits |= TagBits.ContainsNestedTypes;
523
				}
506
				break;
524
				break;
507
			case Wildcard.UNBOUND :
525
			case Wildcard.UNBOUND :
508
	    }
526
		}
509
		return this;
527
		return this;
510
	}
528
	}
511
529
(-)compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (+7 lines)
Lines 516-521 Link Here
516
			enclosingClassFile.recordInnerClasses(this.binding);
516
			enclosingClassFile.recordInnerClasses(this.binding);
517
			classFile.recordInnerClasses(this.binding);
517
			classFile.recordInnerClasses(this.binding);
518
		}
518
		}
519
		TypeVariableBinding[] typeVariables = this.binding.typeVariables();
520
		for (int i = 0, max = typeVariables.length; i < max; i++) {
521
			TypeVariableBinding typeVariableBinding = typeVariables[i];
522
			if ((typeVariableBinding.tagBits & TagBits.ContainsNestedTypes) != 0) {
523
				Util.recordNestedType(classFile, typeVariableBinding);
524
			}
525
		}
519
526
520
		// generate all fiels
527
		// generate all fiels
521
		classFile.addFieldInfos();
528
		classFile.addFieldInfos();
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedSingleTypeReference.java (-16 / +16 lines)
Lines 163-194 Link Here
163
		}
163
		}
164
164
165
		// check generic and arity
165
		// check generic and arity
166
	    boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
166
		boolean isClassScope = scope.kind == Scope.CLASS_SCOPE;
167
	    TypeReference keep = null;
167
		TypeReference keep = null;
168
	    if (isClassScope) {
168
		if (isClassScope) {
169
	    	keep = ((ClassScope) scope).superTypeReference;
169
			keep = ((ClassScope) scope).superTypeReference;
170
	    	((ClassScope) scope).superTypeReference = null;
170
			((ClassScope) scope).superTypeReference = null;
171
	    }
171
		}
172
		int argLength = this.typeArguments.length;
172
		int argLength = this.typeArguments.length;
173
		TypeBinding[] argTypes = new TypeBinding[argLength];
173
		TypeBinding[] argTypes = new TypeBinding[argLength];
174
		boolean argHasError = false;
174
		boolean argHasError = false;
175
		ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
175
		ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
176
		for (int i = 0; i < argLength; i++) {
176
		for (int i = 0; i < argLength; i++) {
177
		    TypeReference typeArgument = this.typeArguments[i];
177
			TypeReference typeArgument = this.typeArguments[i];
178
		    TypeBinding argType = isClassScope
178
			TypeBinding argType = isClassScope
179
				? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i)
179
			? typeArgument.resolveTypeArgument((ClassScope) scope, currentOriginal, i)
180
				: typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i);
180
					: typeArgument.resolveTypeArgument((BlockScope) scope, currentOriginal, i);
181
		     if (argType == null) {
181
			if (argType == null) {
182
		         argHasError = true;
182
				argHasError = true;
183
		     } else {
183
			} else {
184
			    argTypes[i] = argType;
184
				argTypes[i] = argType;
185
		     }
185
			}
186
		}
186
		}
187
		if (argHasError) {
187
		if (argHasError) {
188
			return null;
188
			return null;
189
		}
189
		}
190
		if (isClassScope) {
190
		if (isClassScope) {
191
	    	((ClassScope) scope).superTypeReference = keep;
191
			((ClassScope) scope).superTypeReference = keep;
192
			if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this))
192
			if (((ClassScope) scope).detectHierarchyCycle(currentOriginal, this))
193
				return null;
193
				return null;
194
		}
194
		}
(-)compiler/org/eclipse/jdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.java (-10 / +10 lines)
Lines 198-217 Link Here
198
			}
198
			}
199
199
200
			// check generic and arity
200
			// check generic and arity
201
		    TypeReference[] args = this.typeArguments[i];
201
			TypeReference[] args = this.typeArguments[i];
202
		    if (args != null) {
202
			if (args != null) {
203
			    TypeReference keep = null;
203
				TypeReference keep = null;
204
			    if (isClassScope) {
204
				if (isClassScope) {
205
			    	keep = ((ClassScope) scope).superTypeReference;
205
					keep = ((ClassScope) scope).superTypeReference;
206
			    	((ClassScope) scope).superTypeReference = null;
206
					((ClassScope) scope).superTypeReference = null;
207
			    }
207
				}
208
				int argLength = args.length;
208
				int argLength = args.length;
209
				TypeBinding[] argTypes = new TypeBinding[argLength];
209
				TypeBinding[] argTypes = new TypeBinding[argLength];
210
				boolean argHasError = false;
210
				boolean argHasError = false;
211
				ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
211
				ReferenceBinding currentOriginal = (ReferenceBinding)currentType.original();
212
				for (int j = 0; j < argLength; j++) {
212
				for (int j = 0; j < argLength; j++) {
213
				    TypeReference arg = args[j];
213
					TypeReference arg = args[j];
214
				    TypeBinding argType = isClassScope
214
					TypeBinding argType = isClassScope
215
						? arg.resolveTypeArgument((ClassScope) scope, currentOriginal, j)
215
						? arg.resolveTypeArgument((ClassScope) scope, currentOriginal, j)
216
						: arg.resolveTypeArgument((BlockScope) scope, currentOriginal, j);
216
						: arg.resolveTypeArgument((BlockScope) scope, currentOriginal, j);
217
					if (argType == null) {
217
					if (argType == null) {
Lines 229-235 Link Here
229
						return null;
229
						return null;
230
				}
230
				}
231
231
232
			    TypeVariableBinding[] typeVariables = currentOriginal.typeVariables();
232
				TypeVariableBinding[] typeVariables = currentOriginal.typeVariables();
233
				if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
233
				if (typeVariables == Binding.NO_TYPE_VARIABLES) { // check generic
234
					if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { // below 1.5, already reported as syntax error
234
					if (scope.compilerOptions().sourceLevel >= ClassFileConstants.JDK1_5) { // below 1.5, already reported as syntax error
235
						scope.problemReporter().nonGenericTypeCannotBeParameterized(i, this, currentType, argTypes);
235
						scope.problemReporter().nonGenericTypeCannotBeParameterized(i, this, currentType, argTypes);
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/CodeStream.java (-50 / +50 lines)
Lines 1217-1224 Link Here
1217
1217
1218
public void fieldAccess(byte opcode, FieldBinding fieldBinding, TypeBinding declaringClass) {
1218
public void fieldAccess(byte opcode, FieldBinding fieldBinding, TypeBinding declaringClass) {
1219
	if (declaringClass == null) declaringClass = fieldBinding.declaringClass;
1219
	if (declaringClass == null) declaringClass = fieldBinding.declaringClass;
1220
	if (declaringClass.leafComponentType().isNestedType()) {
1220
	if ((declaringClass.tagBits & TagBits.ContainsNestedTypes) != 0) {
1221
		this.classFile.recordInnerClasses(declaringClass);
1221
		Util.recordNestedType(this.classFile, declaringClass);
1222
	}
1222
	}
1223
	TypeBinding returnType = fieldBinding.type;
1223
	TypeBinding returnType = fieldBinding.type;
1224
	int returnTypeSize;
1224
	int returnTypeSize;
Lines 3835-3886 Link Here
3835
3835
3836
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) {
3836
public void invoke(byte opcode, MethodBinding methodBinding, TypeBinding declaringClass) {
3837
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
3837
	if (declaringClass == null) declaringClass = methodBinding.declaringClass;
3838
    if (declaringClass.isNestedType()) {
3838
	if ((declaringClass.tagBits & TagBits.ContainsNestedTypes) != 0) {
3839
        this.classFile.recordInnerClasses(declaringClass);
3839
		Util.recordNestedType(this.classFile, declaringClass);
3840
    }
3840
	}
3841
    // compute receiverAndArgsSize
3841
	// compute receiverAndArgsSize
3842
    int receiverAndArgsSize;
3842
	int receiverAndArgsSize;
3843
    switch(opcode) {
3843
	switch(opcode) {
3844
    	case Opcodes.OPC_invokestatic :
3844
		case Opcodes.OPC_invokestatic :
3845
    		receiverAndArgsSize = 0; // no receiver
3845
			receiverAndArgsSize = 0; // no receiver
3846
    		break;
3846
			break;
3847
    	case Opcodes.OPC_invokeinterface :
3847
		case Opcodes.OPC_invokeinterface :
3848
    	case Opcodes.OPC_invokevirtual :
3848
		case Opcodes.OPC_invokevirtual :
3849
    		receiverAndArgsSize = 1; // receiver
3849
			receiverAndArgsSize = 1; // receiver
3850
    		break;
3850
			break;
3851
    	case Opcodes.OPC_invokespecial :
3851
		case Opcodes.OPC_invokespecial :
3852
    		receiverAndArgsSize = 1; // receiver
3852
			receiverAndArgsSize = 1; // receiver
3853
    		if (methodBinding.isConstructor()) {
3853
			if (methodBinding.isConstructor()) {
3854
    			if (declaringClass.isNestedType()) {
3854
				if (declaringClass.isNestedType()) {
3855
        			ReferenceBinding nestedType = (ReferenceBinding) declaringClass;
3855
					ReferenceBinding nestedType = (ReferenceBinding) declaringClass;
3856
    				// enclosing instances
3856
					// enclosing instances
3857
        			receiverAndArgsSize += nestedType.getEnclosingInstancesSlotSize();
3857
					receiverAndArgsSize += nestedType.getEnclosingInstancesSlotSize();
3858
    				// outer local variables
3858
					// outer local variables
3859
    				SyntheticArgumentBinding[] syntheticArguments = nestedType.syntheticOuterLocalVariables();
3859
					SyntheticArgumentBinding[] syntheticArguments = nestedType.syntheticOuterLocalVariables();
3860
    				if (syntheticArguments != null) {
3860
					if (syntheticArguments != null) {
3861
    					for (int i = 0, max = syntheticArguments.length; i < max; i++) {
3861
						for (int i = 0, max = syntheticArguments.length; i < max; i++) {
3862
    						switch (syntheticArguments[i].id)  {
3862
							switch (syntheticArguments[i].id)  {
3863
    							case TypeIds.T_double :
3863
								case TypeIds.T_double :
3864
    							case TypeIds.T_long :
3864
								case TypeIds.T_long :
3865
	    							receiverAndArgsSize += 2;
3865
									receiverAndArgsSize += 2;
3866
									break;
3866
									break;
3867
    							default: 
3867
								default: 
3868
	    							receiverAndArgsSize++;
3868
									receiverAndArgsSize++;
3869
    								break;
3869
									break;
3870
    						}    						
3870
							}    						
3871
    					}
3871
						}
3872
    				}
3872
					}
3873
    			}
3873
				}
3874
    			if (declaringClass.isEnum()) {
3874
				if (declaringClass.isEnum()) {
3875
    				// adding String (name) and int (ordinal)
3875
					// adding String (name) and int (ordinal)
3876
    				receiverAndArgsSize += 2;
3876
					receiverAndArgsSize += 2;
3877
    			}
3877
				}
3878
    		}    		
3878
			}    		
3879
    		break;
3879
			break;
3880
    	default :
3880
		default :
3881
    		return; // should not occur
3881
			return; // should not occur
3882
    		
3882
3883
    }
3883
	}
3884
	for (int i = methodBinding.parameters.length - 1; i >= 0; i--) {
3884
	for (int i = methodBinding.parameters.length - 1; i >= 0; i--) {
3885
		switch (methodBinding.parameters[i].id) {
3885
		switch (methodBinding.parameters[i].id) {
3886
			case TypeIds.T_double :
3886
			case TypeIds.T_double :
Lines 3993-4001 Link Here
3993
3993
3994
public void invokeIterableIterator(TypeBinding iterableReceiverType) {
3994
public void invokeIterableIterator(TypeBinding iterableReceiverType) {
3995
	// invokevirtual/interface: <iterableReceiverType>.iterator()
3995
	// invokevirtual/interface: <iterableReceiverType>.iterator()
3996
    if (iterableReceiverType.isNestedType()) {
3996
	if ((iterableReceiverType.tagBits & TagBits.ContainsNestedTypes) != 0) {
3997
        this.classFile.recordInnerClasses(iterableReceiverType);
3997
		Util.recordNestedType(this.classFile, iterableReceiverType);
3998
    }	
3998
	}
3999
	invoke(
3999
	invoke(
4000
			iterableReceiverType.isInterface() ? Opcodes.OPC_invokeinterface : Opcodes.OPC_invokevirtual,
4000
			iterableReceiverType.isInterface() ? Opcodes.OPC_invokeinterface : Opcodes.OPC_invokevirtual,
4001
			1, // receiverAndArgsSize
4001
			1, // receiverAndArgsSize
(-)compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java (-14 / +16 lines)
Lines 13-22 Link Here
13
import org.eclipse.jdt.core.compiler.CharOperation;
13
import org.eclipse.jdt.core.compiler.CharOperation;
14
import org.eclipse.jdt.internal.compiler.ClassFile;
14
import org.eclipse.jdt.internal.compiler.ClassFile;
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
16
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
16
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
17
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
17
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
18
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
18
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
19
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
19
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
20
import org.eclipse.jdt.internal.compiler.util.HashtableOfObject;
21
import org.eclipse.jdt.internal.compiler.util.Util;
20
/**
22
/**
21
 * This type is used to store all the constant pool entries.
23
 * This type is used to store all the constant pool entries.
22
 */
24
 */
Lines 297-307 Link Here
297
    return index;
299
    return index;
298
}
300
}
299
public int literalIndex(TypeBinding binding) {
301
public int literalIndex(TypeBinding binding) {
300
    TypeBinding typeBinding = binding.leafComponentType();
302
	TypeBinding typeBinding = binding.leafComponentType();
301
    if (typeBinding.isNestedType()) {
303
	if ((typeBinding.tagBits & TagBits.ContainsNestedTypes) != 0) {
302
        this.classFile.recordInnerClasses(typeBinding);
304
		Util.recordNestedType(this.classFile, typeBinding);
303
    }
305
	}
304
    return literalIndex(binding.signature());
306
	return literalIndex(binding.signature());
305
}
307
}
306
/**
308
/**
307
 * This method returns the index into the constantPool corresponding to the type descriptor.
309
 * This method returns the index into the constantPool corresponding to the type descriptor.
Lines 647-657 Link Here
647
 * binding must not be an array type.
649
 * binding must not be an array type.
648
 */
650
 */
649
public int literalIndexForType(final TypeBinding binding) {
651
public int literalIndexForType(final TypeBinding binding) {
650
    TypeBinding typeBinding = binding.leafComponentType();
652
	TypeBinding typeBinding = binding.leafComponentType();
651
    if (typeBinding.isNestedType()) {
653
	if ((typeBinding.tagBits & TagBits.ContainsNestedTypes) != 0) {
652
        this.classFile.recordInnerClasses(typeBinding);
654
		Util.recordNestedType(this.classFile, typeBinding);
653
    }
655
	}
654
    return this.literalIndexForType(binding.constantPoolName());
656
	return this.literalIndexForType(binding.constantPoolName());
655
}
657
}
656
public int literalIndexForMethod(char[] declaringClass, char[] selector, char[] signature, boolean isInterface) {
658
public int literalIndexForMethod(char[] declaringClass, char[] selector, char[] signature, boolean isInterface) {
657
    int index;
659
    int index;
Lines 688-697 Link Here
688
    return index;
690
    return index;
689
}
691
}
690
public int literalIndexForMethod(TypeBinding declaringClass, char[] selector, char[] signature, boolean isInterface) {
692
public int literalIndexForMethod(TypeBinding declaringClass, char[] selector, char[] signature, boolean isInterface) {
691
    if (declaringClass.isNestedType()) {
693
	if ((declaringClass.tagBits & TagBits.ContainsNestedTypes) != 0) {
692
        this.classFile.recordInnerClasses(declaringClass);
694
		Util.recordNestedType(this.classFile, declaringClass);
693
    }
695
	}
694
    return this.literalIndexForMethod(declaringClass.constantPoolName(), selector, signature, isInterface);
696
	return this.literalIndexForMethod(declaringClass.constantPoolName(), selector, signature, isInterface);
695
}
697
}
696
public int literalIndexForNameAndType(char[] name, char[] signature) {
698
public int literalIndexForNameAndType(char[] name, char[] signature) {
697
    int index;
699
    int index;
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetTypeDeclaration.java (-1 / +10 lines)
Lines 14-20 Link Here
14
import org.eclipse.jdt.internal.compiler.CompilationResult;
14
import org.eclipse.jdt.internal.compiler.CompilationResult;
15
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
15
import org.eclipse.jdt.internal.compiler.ast.ASTNode;
16
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
16
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
17
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
18
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
17
import org.eclipse.jdt.internal.compiler.problem.AbortType;
19
import org.eclipse.jdt.internal.compiler.problem.AbortType;
20
import org.eclipse.jdt.internal.compiler.util.Util;
18
21
19
public class CodeSnippetTypeDeclaration extends TypeDeclaration {
22
public class CodeSnippetTypeDeclaration extends TypeDeclaration {
20
23
Lines 46-52 Link Here
46
			enclosingClassFile.recordInnerClasses(this.binding);
49
			enclosingClassFile.recordInnerClasses(this.binding);
47
			classFile.recordInnerClasses(this.binding);
50
			classFile.recordInnerClasses(this.binding);
48
		}
51
		}
49
52
		TypeVariableBinding[] typeVariables = this.binding.typeVariables();
53
		for (int i = 0, max = typeVariables.length; i < max; i++) {
54
			TypeVariableBinding typeVariableBinding = typeVariables[i];
55
			if ((typeVariableBinding.tagBits & TagBits.ContainsNestedTypes) != 0) {
56
				Util.recordNestedType(classFile, typeVariableBinding);
57
			}
58
		}
50
		if (this.memberTypes != null) {
59
		if (this.memberTypes != null) {
51
			for (int i = 0, max = this.memberTypes.length; i < max; i++) {
60
			for (int i = 0, max = this.memberTypes.length; i < max; i++) {
52
				TypeDeclaration memberType = this.memberTypes[i];
61
				TypeDeclaration memberType = this.memberTypes[i];
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetClassFile.java (+10 lines)
Lines 24-29 Link Here
24
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
24
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding;
25
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
25
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
26
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
26
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
28
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
29
import org.eclipse.jdt.internal.compiler.util.Util;
27
30
28
public class CodeSnippetClassFile extends ClassFile {
31
public class CodeSnippetClassFile extends ClassFile {
29
/**
32
/**
Lines 144-149 Link Here
144
	if (typeBinding.isNestedType()) {
147
	if (typeBinding.isNestedType()) {
145
		classFile.recordInnerClasses(typeBinding);
148
		classFile.recordInnerClasses(typeBinding);
146
	}
149
	}
150
	TypeVariableBinding[] typeVariables = typeBinding.typeVariables();
151
	for (int i = 0, max = typeVariables.length; i < max; i++) {
152
		TypeVariableBinding typeVariableBinding = typeVariables[i];
153
		if ((typeVariableBinding.tagBits & TagBits.ContainsNestedTypes) != 0) {
154
			Util.recordNestedType(classFile, typeVariableBinding);
155
		}
156
	}
147
157
148
	// add its fields
158
	// add its fields
149
	FieldBinding[] fields = typeBinding.fields();
159
	FieldBinding[] fields = typeBinding.fields();
(-)compiler/org/eclipse/jdt/internal/compiler/util/Util.java (-1 / +51 lines)
Lines 32-37 Link Here
32
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
32
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
33
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
33
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
34
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
34
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
35
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
36
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
37
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
38
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
39
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
40
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
35
41
36
public class Util implements SuffixConstants {
42
public class Util implements SuffixConstants {
37
43
Lines 810-813 Link Here
810
			output.close();
816
			output.close();
811
		}
817
		}
812
	}
818
	}
813
}
819
	public static void recordNestedType(ClassFile classFile, TypeBinding typeBinding) {
820
		if (typeBinding.isNestedType()) {
821
			classFile.recordInnerClasses(typeBinding);
822
		} else if (typeBinding.isParameterizedType()
823
				&& ((typeBinding.tagBits & TagBits.ContainsNestedTypes) != 0)) {
824
			ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) typeBinding;
825
			TypeBinding[] arguments = parameterizedTypeBinding.arguments;
826
			for (int j = 0, max2 = arguments.length; j < max2; j++) {
827
				TypeBinding argument = arguments[j];
828
				if (argument.isWildcard()) {
829
					WildcardBinding wildcardBinding = (WildcardBinding) argument;
830
					TypeBinding bound = wildcardBinding.bound;
831
					if (bound != null) {
832
						recordNestedType(classFile, bound);
833
					}
834
					ReferenceBinding superclass = wildcardBinding.superclass();
835
					if (superclass != null) {
836
						recordNestedType(classFile, superclass);
837
					}
838
					ReferenceBinding[] superInterfaces = wildcardBinding.superInterfaces();
839
					if (superInterfaces != null) {
840
						for (int k = 0, max3 =  superInterfaces.length; k < max3; k++) {
841
							ReferenceBinding superInterface = superInterfaces[k];
842
							recordNestedType(classFile, superInterface);
843
						}
844
					}
845
				} else {
846
					recordNestedType(classFile, argument);
847
				}
848
			}
849
		} else if (typeBinding.isTypeVariable()
850
				&& ((typeBinding.tagBits & TagBits.ContainsNestedTypes) != 0)) {
851
			TypeVariableBinding typeVariableBinding = (TypeVariableBinding) typeBinding;
852
			ReferenceBinding superclass = typeVariableBinding.superclass();
853
			recordNestedType(classFile, superclass);
854
			ReferenceBinding[] superInterfaces = typeVariableBinding.superInterfaces();
855
			if (superInterfaces != null) {
856
				for (int k = 0, max3 =  superInterfaces.length; k < max3; k++) {
857
					ReferenceBinding superInterface = superInterfaces[k];
858
					recordNestedType(classFile, superInterface);
859
				}
860
			}
861
		}
862
	}
863
}
(-)compiler/org/eclipse/jdt/internal/compiler/ClassFile.java (-1 / +8 lines)
Lines 67-72 Link Here
67
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
67
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
68
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
68
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
69
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
69
import org.eclipse.jdt.internal.compiler.lookup.TypeIds;
70
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
70
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
71
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
71
import org.eclipse.jdt.internal.compiler.problem.ShouldNotImplement;
72
import org.eclipse.jdt.internal.compiler.problem.ShouldNotImplement;
72
import org.eclipse.jdt.internal.compiler.util.Messages;
73
import org.eclipse.jdt.internal.compiler.util.Messages;
Lines 151-157 Link Here
151
		if (typeBinding.isNestedType()) {
152
		if (typeBinding.isNestedType()) {
152
			classFile.recordInnerClasses(typeBinding);
153
			classFile.recordInnerClasses(typeBinding);
153
		}
154
		}
154
155
		TypeVariableBinding[] typeVariables = typeBinding.typeVariables();
156
		for (int i = 0, max = typeVariables.length; i < max; i++) {
157
			TypeVariableBinding typeVariableBinding = typeVariables[i];
158
			if ((typeVariableBinding.tagBits & TagBits.ContainsNestedTypes) != 0) {
159
				Util.recordNestedType(classFile, typeVariableBinding);
160
			}
161
		}
155
		// add its fields
162
		// add its fields
156
		FieldBinding[] fields = typeBinding.fields();
163
		FieldBinding[] fields = typeBinding.fields();
157
		if ((fields != null) && (fields != Binding.NO_FIELDS)) {
164
		if ((fields != null) && (fields != Binding.NO_FIELDS)) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java (+1 lines)
Lines 91-96 Link Here
91
	since_1_5.add(BatchCompilerTest.class);
91
	since_1_5.add(BatchCompilerTest.class);
92
	since_1_5.add(ExternalizeStringLiterals15Test.class);
92
	since_1_5.add(ExternalizeStringLiterals15Test.class);
93
	since_1_5.add(Deprecated15Test.class);
93
	since_1_5.add(Deprecated15Test.class);
94
	since_1_5.add(InnerEmulationTest_1_5.class);
94
95
95
	// Tests to run when compliance is greater than 1.5
96
	// Tests to run when compliance is greater than 1.5
96
	ArrayList since_1_6 = new ArrayList();
97
	ArrayList since_1_6 = new ArrayList();
(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest_1_5.java (+98 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2009 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests.compiler.regression;
12
13
import java.io.File;
14
15
import junit.framework.Test;
16
17
public class InnerEmulationTest_1_5 extends AbstractRegressionTest {
18
static {
19
//		TESTS_NAMES = new String[] { "Bug58069" };
20
//		TESTS_NUMBERS = new int[] { 4 };
21
//		TESTS_RANGE = new int[] { 144, -1 };
22
}
23
public InnerEmulationTest_1_5(String name) {
24
	super(name);
25
}
26
public static Test suite() {
27
	return buildMinimalComplianceTestSuite(testClass(), F_1_5);
28
}
29
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
30
public void test1() throws Exception {
31
	this.runConformTest(new String[] {
32
		"X.java",
33
		"import java.util.Collection;\n" +
34
		"import java.util.Map;\n" +
35
		"public class X {\n" +
36
		"	public void foo(Collection<? extends Map.Entry> args) { /* dummy */ }\n" +
37
		"}"
38
	});
39
	String expectedOutput =
40
		"  Inner classes:\n" + 
41
		"    [inner class info: #25 java/util/Map$Entry, outer class info: #27 java/util/Map\n" + 
42
		"     inner name: #29 Entry, accessflags: 1545 public abstract static]\n";
43
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
44
}
45
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
46
public void test2() throws Exception {
47
	this.runConformTest(new String[] {
48
		"p/X.java",
49
		"package p;\n" +
50
		"import java.util.Collection;\n" +
51
		"import java.util.Map;\n" +
52
		"public class X {\n" +
53
		"	public void foo(Map.Entry args) { /* dummy */ }\n" +
54
		"}"
55
	});
56
	String expectedOutput =
57
		"  Inner classes:\n" + 
58
		"    [inner class info: #21 java/util/Map$Entry, outer class info: #23 java/util/Map\n" + 
59
		"     inner name: #25 Entry, accessflags: 1545 public abstract static]\n";
60
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
61
}
62
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
63
public void test3() throws Exception {
64
	this.runConformTest(new String[] {
65
		"X.java",
66
		"import java.util.Map;\n" + 
67
		"import java.util.List;\n" + 
68
		"public class X {\n" + 
69
		"	<U extends List<?>, T extends Map.Entry> X(List<U> lu, T t) {\n" + 
70
		"	}\n" + 
71
		"}"
72
	});
73
	String expectedOutput =
74
		"  Inner classes:\n" + 
75
		"    [inner class info: #27 java/util/Map$Entry, outer class info: #29 java/util/Map\n" + 
76
		"     inner name: #31 Entry, accessflags: 1545 public abstract static]\n";
77
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
78
}
79
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
80
public void test4() throws Exception {
81
	this.runConformTest(new String[] {
82
		"X.java",
83
		"import java.util.Map;\n" + 
84
		"import java.util.List;\n" + 
85
		"public class X<T extends Object & Comparable<? super Map.Entry>> {}"
86
	});
87
	String expectedOutput =
88
		"  Inner classes:\n" + 
89
		"    [inner class info: #21 java/util/Map$Entry, outer class info: #23 java/util/Map\n" + 
90
		"     inner name: #25 Entry, accessflags: 1545 public abstract static]\n";
91
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
92
}
93
94
95
public static Class testClass() {
96
	return InnerEmulationTest_1_5.class;
97
}
98
}
(-)Eclipse Java Tests Runner/org/eclipse/jdt/core/tests/RunAllDisassemblerTests.java (+1 lines)
Lines 69-74 Link Here
69
		tests_1_5.add(ForeachStatementTest.class);
69
		tests_1_5.add(ForeachStatementTest.class);
70
		tests_1_5.add(GenericTypeTest.class);
70
		tests_1_5.add(GenericTypeTest.class);
71
		tests_1_5.add(MethodVerifyTest.class);
71
		tests_1_5.add(MethodVerifyTest.class);
72
		tests_1_5.add(InnerEmulationTest_1_5.class);
72
		all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_5, tests_1_5));
73
		all.addTest(AbstractCompilerTest.buildComplianceTestSuite(ClassFileConstants.JDK1_5, tests_1_5));
73
	}
74
	}
74
	if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) {
75
	if ((possibleComplianceLevels & AbstractCompilerTest.F_1_6) != 0) {

Return to bug 275381