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

Collapse All | Expand All

(-)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 (+292 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[] { 13 };
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
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
94
public void test5() throws Exception {
95
	this.runConformTest(new String[] {
96
		"p/X.java",
97
		"package p;\n" +
98
		"import java.util.Collection;\n" +
99
		"import java.util.Map;\n" +
100
		"public class X {\n" +
101
		"	public void foo(Map.Entry<String, String> args) { /* dummy */ }\n" +
102
		"}"
103
	});
104
	String expectedOutput =
105
		"  Inner classes:\n" + 
106
		"    [inner class info: #25 java/util/Map$Entry, outer class info: #27 java/util/Map\n" + 
107
		"     inner name: #29 Entry, accessflags: 1545 public abstract static]\n";
108
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
109
}
110
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
111
public void test6() throws Exception {
112
	this.runConformTest(new String[] {
113
		"p/X.java",
114
		"package p;\n" +
115
		"import java.util.Collection;\n" +
116
		"import java.util.Map;\n" +
117
		"public class X {\n" +
118
		"	Map.Entry<String, String> f;\n" +
119
		"}"
120
	});
121
	String expectedOutput =
122
		"  Inner classes:\n" + 
123
		"    [inner class info: #21 java/util/Map$Entry, outer class info: #23 java/util/Map\n" + 
124
		"     inner name: #25 Entry, accessflags: 1545 public abstract static]\n";
125
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
126
}
127
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
128
public void test7() throws Exception {
129
	this.runConformTest(new String[] {
130
		"p/X.java",
131
		"package p;\n" +
132
		"import java.util.Collection;\n" +
133
		"import java.util.Map;\n" +
134
		"public class X<E extends Object & Map.Entry<String, E>> {\n" +
135
		"}"
136
	});
137
	String expectedOutput =
138
		"  Inner classes:\n" + 
139
		"    [inner class info: #21 java/util/Map$Entry, outer class info: #23 java/util/Map\n" + 
140
		"     inner name: #25 Entry, accessflags: 1545 public abstract static]\n";
141
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
142
}
143
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
144
public void test8() throws Exception {
145
	this.runConformTest(new String[] {
146
		"p/X.java",
147
		"package p;\n" +
148
		"import java.util.Collection;\n" +
149
		"import java.util.Map;\n" +
150
		"class A {\n" +
151
		"	static class B{}\n" +
152
		"}\n" +
153
		"public class X<E extends Object & Map.Entry<E, A.B>> {\n" +
154
		"}"
155
	});
156
	String expectedOutput =
157
		"  Inner classes:\n" + 
158
		"    [inner class info: #21 java/util/Map$Entry, outer class info: #23 java/util/Map\n" + 
159
		"     inner name: #25 Entry, accessflags: 1545 public abstract static],\n" + 
160
		"    [inner class info: #26 p/A$B, outer class info: #28 p/A\n" + 
161
		"     inner name: #30 B, accessflags: 8 static]\n";
162
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
163
}
164
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
165
public void test9() throws Exception {
166
	this.runConformTest(new String[] {
167
		"p/X.java",
168
		"package p;\n" +
169
		"import java.util.Collection;\n" +
170
		"import java.util.Map;\n" +
171
		"class A {\n" +
172
		"	static class B{}\n" +
173
		"}\n" +
174
		"public class X {\n" +
175
		"	<E extends Object & Map.Entry<E, A.B>> void foo(E e) {}\n" +
176
		"}"
177
	});
178
	String expectedOutput =
179
		"  Inner classes:\n" + 
180
		"    [inner class info: #25 java/util/Map$Entry, outer class info: #27 java/util/Map\n" + 
181
		"     inner name: #29 Entry, accessflags: 1545 public abstract static],\n" + 
182
		"    [inner class info: #30 p/A$B, outer class info: #32 p/A\n" + 
183
		"     inner name: #34 B, accessflags: 8 static]\n";
184
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
185
}
186
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
187
public void test10() throws Exception {
188
	this.runConformTest(new String[] {
189
		"p/X.java",
190
		"package p;\n" +
191
		"import java.util.Collection;\n" +
192
		"import java.util.Map;\n" +
193
		"class A {\n" +
194
		"	static interface B<U, T>{}\n" +
195
		"}\n" +
196
		"class C {\n" +
197
		"	static class D<U, T>{}\n" +
198
		"}\n" +
199
		"public class X {\n" +
200
		"	<E extends Object & A.B<E, Map.Entry<E, C.D>>> void foo(E e) {}\n" +
201
		"}"
202
	});
203
	String expectedOutput =
204
		"  Inner classes:\n" + 
205
		"    [inner class info: #25 java/util/Map$Entry, outer class info: #27 java/util/Map\n" + 
206
		"     inner name: #29 Entry, accessflags: 1545 public abstract static],\n" + 
207
		"    [inner class info: #30 p/A$B, outer class info: #32 p/A\n" + 
208
		"     inner name: #34 B, accessflags: 1544 abstract static],\n" + 
209
		"    [inner class info: #35 p/C$D, outer class info: #37 p/C\n" + 
210
		"     inner name: #39 D, accessflags: 8 static]\n";
211
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
212
}
213
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
214
public void test11() throws Exception {
215
	this.runConformTest(new String[] {
216
		"X.java",
217
		"import java.util.*;\n" +
218
		"\n" +
219
		" public class X {\n" +
220
		" \n" +
221
		"	static abstract class SelfType<T extends SelfType<T>>{\n" +
222
		"	}\n" +
223
		" \n" +
224
		"	static class SuperType extends SelfType<SuperType>{\n" +
225
		"	}\n" +
226
		" \n" +
227
		"	static class SubType extends SuperType{}\n" +
228
		" \n" +
229
		"	static <T extends SelfType<T>> List<T> makeSingletonList(T t){\n" +
230
		"		return Collections.singletonList(t);\n" +
231
		"	}\n" +
232
		" \n" +
233
		"	static <T extends SelfType<T>,S extends T> List<T> makeSingletonList2(S s){\n" +
234
		"		return Collections.singletonList((T)s); // #0\n" +
235
		"	}\n" +
236
		"}"
237
	});
238
	String expectedOutput =
239
		"  Inner classes:\n" + 
240
		"    [inner class info: #35 X$SelfType, outer class info: #1 X\n" + 
241
		"     inner name: #37 SelfType, accessflags: 1032 abstract static],\n" + 
242
		"    [inner class info: #38 X$SubType, outer class info: #1 X\n" + 
243
		"     inner name: #40 SubType, accessflags: 8 static],\n" + 
244
		"    [inner class info: #41 X$SuperType, outer class info: #1 X\n" + 
245
		"     inner name: #43 SuperType, accessflags: 8 static]\n";
246
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "X.class", "X", expectedOutput);
247
}
248
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
249
public void test12() throws Exception {
250
	this.runConformTest(new String[] {
251
		"p/X.java",
252
		"package p;\n" +
253
		"import java.util.Collection;\n" +
254
		"import java.util.Map;\n" +
255
		"public class X {\n" +
256
		"	Collection<Map.Entry> field;\n" +
257
		"}"
258
	});
259
	String expectedOutput =
260
		"  Inner classes:\n" + 
261
		"    [inner class info: #21 java/util/Map$Entry, outer class info: #23 java/util/Map\n" + 
262
		"     inner name: #25 Entry, accessflags: 1545 public abstract static]\n";
263
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
264
}
265
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=275381
266
public void test13() throws Exception {
267
	this.runConformTest(new String[] {
268
		"p/X.java",
269
		"package p;\n" +
270
		"import java.util.Collection;\n" +
271
		"import java.util.Map;\n" +
272
		"class A {\n" +
273
		"	static interface B<U, T>{}\n" +
274
		"}\n" +
275
		"class C {\n" +
276
		"	static class D<U, T>{}\n" +
277
		"}\n" +
278
		"public class X extends C.D implements A.B {\n" +
279
		"}"
280
	});
281
	String expectedOutput =
282
		"  Inner classes:\n" + 
283
		"    [inner class info: #5 p/A$B, outer class info: #19 p/A\n" + 
284
		"     inner name: #21 B, accessflags: 1544 abstract static],\n" + 
285
		"    [inner class info: #3 p/C$D, outer class info: #22 p/C\n" + 
286
		"     inner name: #24 D, accessflags: 8 static]\n";
287
	checkDisassembledClassFile(OUTPUT_DIR + File.separator + "p" + File.separator + "X.class", "X", expectedOutput);
288
}
289
public static Class testClass() {
290
	return InnerEmulationTest_1_5.class;
291
}
292
}
(-)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) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/ParameterizedTypeBinding.java (-4 / +9 lines)
Lines 673-682 Link Here
673
						this.tagBits |= TagBits.IsBoundParameterizedType;
673
						this.tagBits |= TagBits.IsBoundParameterizedType;
674
						break;
674
						break;
675
				}
675
				}
676
			    this.tagBits |= someArgument.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
676
				this.tagBits |= someArgument.tagBits & (TagBits.HasTypeVariable | TagBits.HasMissingType);
677
				this.tagBits |= someArgument.tagBits & TagBits.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences);
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.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences);
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.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences;
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 / +24 lines)
Lines 20-25 Link Here
20
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
20
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
22
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
22
import org.eclipse.jdt.internal.compiler.codegen.ConstantPool;
23
import org.eclipse.jdt.internal.compiler.util.Util;
23
24
24
public class MethodBinding extends Binding {
25
public class MethodBinding extends Binding {
25
26
Lines 962-968 Link Here
962
 */
963
 */
963
public final char[] signature(ClassFile classFile) {
964
public final char[] signature(ClassFile classFile) {
964
	if (this.signature != null) {
965
	if (this.signature != null) {
965
		if ((this.tagBits & TagBits.ContainsNestedTypesInSignature) != 0) {
966
		if ((this.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
966
			// we need to record inner classes references
967
			// we need to record inner classes references
967
			boolean isConstructor = isConstructor();
968
			boolean isConstructor = isConstructor();
968
			TypeBinding[] targetParameters = this.parameters;
969
			TypeBinding[] targetParameters = this.parameters;
Lines 973-980 Link Here
973
				if (syntheticArgumentTypes != null) {
974
				if (syntheticArgumentTypes != null) {
974
					for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
975
					for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
975
						ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
976
						ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
976
						if (syntheticArgumentType.isNestedType()) {
977
						if ((syntheticArgumentType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
977
							classFile.recordInnerClasses(syntheticArgumentType);
978
							Util.recordNestedType(classFile, syntheticArgumentType);
978
						}
979
						}
979
					}
980
					}
980
				}
981
				}
Lines 984-994 Link Here
984
			}
985
			}
985
986
986
			if (targetParameters != Binding.NO_PARAMETERS) {
987
			if (targetParameters != Binding.NO_PARAMETERS) {
987
				for (int i = 0; i < targetParameters.length; i++) {
988
				for (int i = 0, max = targetParameters.length; i < max; i++) {
988
					TypeBinding targetParameter = targetParameters[i];
989
					TypeBinding targetParameter = targetParameters[i];
989
					TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
990
					TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
990
					if (leafTargetParameterType.isNestedType()) {
991
					if ((leafTargetParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
991
						classFile.recordInnerClasses(leafTargetParameterType);
992
						Util.recordNestedType(classFile, leafTargetParameterType);
992
					}
993
					}
993
				}
994
				}
994
			}
995
			}
Lines 997-1011 Link Here
997
				for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
998
				for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
998
					TypeBinding parameter = this.parameters[i];
999
					TypeBinding parameter = this.parameters[i];
999
					TypeBinding leafParameterType = parameter.leafComponentType();
1000
					TypeBinding leafParameterType = parameter.leafComponentType();
1000
					if (leafParameterType.isNestedType()) {
1001
					if ((leafParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
1001
						classFile.recordInnerClasses(leafParameterType);
1002
						Util.recordNestedType(classFile, leafParameterType);
1002
					}
1003
					}
1003
				}
1004
				}
1004
			}
1005
			}
1005
			if (this.returnType != null) {
1006
			if (this.returnType != null) {
1006
				TypeBinding ret = this.returnType.leafComponentType();
1007
				TypeBinding ret = this.returnType.leafComponentType();
1007
				if (ret.isNestedType()) {
1008
				if ((ret.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
1008
					classFile.recordInnerClasses(ret);
1009
					Util.recordNestedType(classFile, ret);
1009
				}
1010
				}
1010
			}
1011
			}
1011
		}
1012
		}
Lines 1028-1036 Link Here
1028
		if (syntheticArgumentTypes != null) {
1029
		if (syntheticArgumentTypes != null) {
1029
			for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
1030
			for (int i = 0, count = syntheticArgumentTypes.length; i < count; i++) {
1030
				ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
1031
				ReferenceBinding syntheticArgumentType = syntheticArgumentTypes[i];
1031
				if (syntheticArgumentType.isNestedType()) {
1032
				if ((syntheticArgumentType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
1032
					this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1033
					this.tagBits |= TagBits.ContainsNestedTypeReferences;
1033
					classFile.recordInnerClasses(syntheticArgumentType);
1034
					Util.recordNestedType(classFile, syntheticArgumentType);
1034
				}
1035
				}
1035
				buffer.append(syntheticArgumentType.signature());
1036
				buffer.append(syntheticArgumentType.signature());
1036
			}
1037
			}
Lines 1042-1053 Link Here
1042
	}
1043
	}
1043
1044
1044
	if (targetParameters != Binding.NO_PARAMETERS) {
1045
	if (targetParameters != Binding.NO_PARAMETERS) {
1045
		for (int i = 0; i < targetParameters.length; i++) {
1046
		for (int i = 0, max = targetParameters.length; i < max; i++) {
1046
			TypeBinding targetParameter = targetParameters[i];
1047
			TypeBinding targetParameter = targetParameters[i];
1047
			TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
1048
			TypeBinding leafTargetParameterType = targetParameter.leafComponentType();
1048
			if (leafTargetParameterType.isNestedType()) {
1049
			if ((leafTargetParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
1049
				this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1050
				this.tagBits |= TagBits.ContainsNestedTypeReferences;
1050
				classFile.recordInnerClasses(leafTargetParameterType);
1051
				Util.recordNestedType(classFile, leafTargetParameterType);
1051
			}
1052
			}
1052
			buffer.append(targetParameter.signature());
1053
			buffer.append(targetParameter.signature());
1053
		}
1054
		}
Lines 1062-1070 Link Here
1062
		for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
1063
		for (int i = targetParameters.length, extraLength = this.parameters.length; i < extraLength; i++) {
1063
			TypeBinding parameter = this.parameters[i];
1064
			TypeBinding parameter = this.parameters[i];
1064
			TypeBinding leafParameterType = parameter.leafComponentType();
1065
			TypeBinding leafParameterType = parameter.leafComponentType();
1065
			if (leafParameterType.isNestedType()) {
1066
			if ((leafParameterType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
1066
				this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1067
				this.tagBits |= TagBits.ContainsNestedTypeReferences;
1067
				classFile.recordInnerClasses(leafParameterType);
1068
				Util.recordNestedType(classFile, leafParameterType);
1068
			}
1069
			}
1069
			buffer.append(parameter.signature());
1070
			buffer.append(parameter.signature());
1070
		}
1071
		}
Lines 1072-1080 Link Here
1072
	buffer.append(')');
1073
	buffer.append(')');
1073
	if (this.returnType != null) {
1074
	if (this.returnType != null) {
1074
		TypeBinding ret = this.returnType.leafComponentType();
1075
		TypeBinding ret = this.returnType.leafComponentType();
1075
		if (ret.isNestedType()) {
1076
		if ((ret.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
1076
			this.tagBits |= TagBits.ContainsNestedTypesInSignature;
1077
			this.tagBits |= TagBits.ContainsNestedTypeReferences;
1077
			classFile.recordInnerClasses(ret);
1078
			Util.recordNestedType(classFile, ret);
1078
		}
1079
		}
1079
		buffer.append(this.returnType.signature());
1080
		buffer.append(this.returnType.signature());
1080
	}
1081
	}
(-)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 ContainsNestedTypeReferences = ASTNode.Bit12; // method/parameterized type binding
23
	long MemberTypeMask = IsNestedType | IsMemberType | ContainsNestedTypeReferences;
23
	long IsLocalType = ASTNode.Bit5;
24
	long IsLocalType = ASTNode.Bit5;
24
	long LocalTypeMask = IsNestedType | IsLocalType;
25
	long LocalTypeMask = IsNestedType | IsLocalType | ContainsNestedTypeReferences;
25
	long IsAnonymousType = ASTNode.Bit6;
26
	long IsAnonymousType = ASTNode.Bit6;
26
	long AnonymousTypeMask = LocalTypeMask | IsAnonymousType;
27
	long AnonymousTypeMask = LocalTypeMask | IsAnonymousType | ContainsNestedTypeReferences;
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/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.ContainsNestedTypeReferences);
25
	this.enclosingType = enclosingType;
25
	this.enclosingType = enclosingType;
26
}
26
}
27
27
(-)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.ContainsNestedTypeReferences);
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.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences) != 0)) {
502
	        	}
508
					this.tagBits |= TagBits.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences) != 0)) {
514
						this.tagBits |= TagBits.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences) != 0)) {
522
					this.tagBits |= TagBits.ContainsNestedTypeReferences;
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.ContainsNestedTypeReferences) != 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/CompilationUnitDeclaration.java (+1 lines)
Lines 146-151 Link Here
146
		classFile.referenceBinding = null;
146
		classFile.referenceBinding = null;
147
		classFile.innerClassesBindings = null;
147
		classFile.innerClassesBindings = null;
148
		classFile.missingTypes = null;
148
		classFile.missingTypes = null;
149
		classFile.visitedTypes = null;
149
	}
150
	}
150
151
151
	this.suppressWarningAnnotations = null;
152
	this.suppressWarningAnnotations = null;
(-)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.ContainsNestedTypeReferences) != 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.ContainsNestedTypeReferences) != 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.ContainsNestedTypeReferences) != 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.ContainsNestedTypeReferences) != 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.ContainsNestedTypeReferences) != 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.ContainsNestedTypeReferences) != 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.ContainsNestedTypeReferences) != 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.ContainsNestedTypeReferences) != 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 / +73 lines)
Lines 23-28 Link Here
23
import java.io.PrintWriter;
23
import java.io.PrintWriter;
24
import java.io.StringWriter;
24
import java.io.StringWriter;
25
import java.io.UnsupportedEncodingException;
25
import java.io.UnsupportedEncodingException;
26
import java.util.HashSet;
26
import java.util.StringTokenizer;
27
import java.util.StringTokenizer;
27
import java.util.zip.ZipEntry;
28
import java.util.zip.ZipEntry;
28
import java.util.zip.ZipFile;
29
import java.util.zip.ZipFile;
Lines 32-37 Link Here
32
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
33
import org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
33
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
34
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
34
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
35
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
36
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding;
37
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding;
38
import org.eclipse.jdt.internal.compiler.lookup.TagBits;
39
import org.eclipse.jdt.internal.compiler.lookup.TypeBinding;
40
import org.eclipse.jdt.internal.compiler.lookup.TypeVariableBinding;
41
import org.eclipse.jdt.internal.compiler.lookup.WildcardBinding;
35
42
36
public class Util implements SuffixConstants {
43
public class Util implements SuffixConstants {
37
44
Lines 810-813 Link Here
810
			output.close();
817
			output.close();
811
		}
818
		}
812
	}
819
	}
813
}
820
	public static void recordNestedType(ClassFile classFile, TypeBinding typeBinding) {
821
		if (classFile.visitedTypes == null) {
822
			classFile.visitedTypes = new HashSet(3);
823
		} else if (classFile.visitedTypes.contains(typeBinding)) {
824
			// type is already visited
825
			return;
826
		}
827
		classFile.visitedTypes.add(typeBinding);
828
		if (typeBinding.isParameterizedType()
829
				&& ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
830
			ParameterizedTypeBinding parameterizedTypeBinding = (ParameterizedTypeBinding) typeBinding;
831
			ReferenceBinding genericType = parameterizedTypeBinding.genericType();
832
			if ((genericType.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
833
				recordNestedType(classFile, genericType);
834
			}
835
			TypeBinding[] arguments = parameterizedTypeBinding.arguments;
836
			if (arguments != null) {
837
				for (int j = 0, max2 = arguments.length; j < max2; j++) {
838
					TypeBinding argument = arguments[j];
839
					if (argument.isWildcard()) {
840
						WildcardBinding wildcardBinding = (WildcardBinding) argument;
841
						TypeBinding bound = wildcardBinding.bound;
842
						if (bound != null
843
								&& ((bound.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
844
							recordNestedType(classFile, bound);
845
						}
846
						ReferenceBinding superclass = wildcardBinding.superclass();
847
						if (superclass != null
848
								&& ((superclass.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
849
							recordNestedType(classFile, superclass);
850
						}
851
						ReferenceBinding[] superInterfaces = wildcardBinding.superInterfaces();
852
						if (superInterfaces != null) {
853
							for (int k = 0, max3 =  superInterfaces.length; k < max3; k++) {
854
								ReferenceBinding superInterface = superInterfaces[k];
855
								if ((superInterface.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
856
									recordNestedType(classFile, superInterface);
857
								}
858
							}
859
						}
860
					} else if ((argument.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
861
						recordNestedType(classFile, argument);
862
					}
863
				}
864
			}
865
		} else if (typeBinding.isTypeVariable()
866
				&& ((typeBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
867
			TypeVariableBinding typeVariableBinding = (TypeVariableBinding) typeBinding;
868
			TypeBinding upperBound = typeVariableBinding.upperBound();
869
			if (upperBound != null && ((upperBound.tagBits & TagBits.ContainsNestedTypeReferences) != 0)) {
870
				recordNestedType(classFile, upperBound);
871
			}
872
			TypeBinding[] upperBounds = typeVariableBinding.otherUpperBounds();
873
			if (upperBounds != null) {
874
				for (int k = 0, max3 =  upperBounds.length; k < max3; k++) {
875
					TypeBinding otherUpperBound = upperBounds[k];
876
					if ((otherUpperBound.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
877
						recordNestedType(classFile, otherUpperBound);
878
					}
879
				}
880
			}
881
		} else if (typeBinding.isNestedType()) {
882
			classFile.recordInnerClasses(typeBinding);
883
		}
884
	}
885
}
(-)compiler/org/eclipse/jdt/internal/compiler/ClassFile.java (-1 / +11 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 123-128 Link Here
123
124
124
	public List missingTypes = null;
125
	public List missingTypes = null;
125
126
127
	public Set visitedTypes;
128
126
	public static final int INITIAL_CONTENTS_SIZE = 400;
129
	public static final int INITIAL_CONTENTS_SIZE = 400;
127
	public static final int INITIAL_HEADER_SIZE = 1500;
130
	public static final int INITIAL_HEADER_SIZE = 1500;
128
	public static final int INNER_CLASSES_SIZE = 5;
131
	public static final int INNER_CLASSES_SIZE = 5;
Lines 151-157 Link Here
151
		if (typeBinding.isNestedType()) {
154
		if (typeBinding.isNestedType()) {
152
			classFile.recordInnerClasses(typeBinding);
155
			classFile.recordInnerClasses(typeBinding);
153
		}
156
		}
154
157
		TypeVariableBinding[] typeVariables = typeBinding.typeVariables();
158
		for (int i = 0, max = typeVariables.length; i < max; i++) {
159
			TypeVariableBinding typeVariableBinding = typeVariables[i];
160
			if ((typeVariableBinding.tagBits & TagBits.ContainsNestedTypeReferences) != 0) {
161
				Util.recordNestedType(classFile, typeVariableBinding);
162
			}
163
		}
155
		// add its fields
164
		// add its fields
156
		FieldBinding[] fields = typeBinding.fields();
165
		FieldBinding[] fields = typeBinding.fields();
157
		if ((fields != null) && (fields != Binding.NO_FIELDS)) {
166
		if ((fields != null) && (fields != Binding.NO_FIELDS)) {
Lines 7182-7187 Link Here
7182
			this.innerClassesBindings.clear();
7191
			this.innerClassesBindings.clear();
7183
		}
7192
		}
7184
		this.missingTypes = null;
7193
		this.missingTypes = null;
7194
		this.visitedTypes = null;
7185
	}
7195
	}
7186
7196
7187
	/**
7197
	/**

Return to bug 275381