View | Details | Raw Unified | Return to bug 431911
Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java (-149 lines)
Lines 76-230 import java.util.regex.Pattern; Link Here
76
76
77
public abstract class AbstractRegressionTest extends AbstractCompilerTest implements StopableTestCase {
77
public abstract class AbstractRegressionTest extends AbstractCompilerTest implements StopableTestCase {
78
78
79
	// for compiling against JRE 8:
80
	static final boolean IS_JRE_8;
81
	static final String COMPARATOR_IMPL_JRE8;
82
	static final String COMPARATOR_RAW_IMPL_JRE8;
83
	static final String COLLECTION_IMPL_JRE8;
84
	static final String COLLECTION_RAW_IMPL_JRE8;
85
	static final String LIST_IMPL_JRE8;
86
	static final String COLLECTION_AND_LIST_IMPL_JRE8;
87
	static final String COLLECTION_AND_LIST_RAW_IMPL_JRE8;
88
	static final String LIST_RAW_IMPL_JRE8;
89
	static final String ITERABLE_IMPL_JRE8;
90
	static final String ITERABLE_RAW_IMPL_JRE8;
91
	static final String ITERATOR_IMPL_JRE8;
92
	static final String ITERATOR_RAW_IMPL_JRE8;
93
	static final String MAP_IMPL_JRE8;
94
	static final String MAP_RAW_IMPL_JRE8;
95
			
96
	static {
97
		String javaVersion = System.getProperty("java.specification.version");
98
		IS_JRE_8 = "1.8".equals(javaVersion);
99
		if (IS_JRE_8) { // TODO(stephan) accommodate future versions ...
100
			COMPARATOR_IMPL_JRE8 = // replace '*' with T, '%' with U, $ with S
101
				"	public java.util.Comparator<*> reverseOrder() { return null;}\n" +
102
				"	public java.util.Comparator<*> reversed() { return null;}\n" +
103
				"	public java.util.Comparator<*> thenComparing(java.util.Comparator<? super *> other) { return null;}\n" +
104
				"	public <%> java.util.Comparator<*> thenComparing(java.util.function.Function<? super *, ? extends %> keyExtractor, java.util.Comparator<? super %> keyComparator) { return null;}\n" +
105
				"	public <% extends java.lang.Comparable<? super %>> java.util.Comparator<*> thenComparing(java.util.function.Function<? super *, ? extends %> keyExtractor) { return null;}\n" +
106
				"	public java.util.Comparator<*> thenComparingInt(java.util.function.ToIntFunction<? super *> keyExtractor) { return null;}\n" +
107
				"	public java.util.Comparator<*> thenComparingLong(java.util.function.ToLongFunction<? super *> keyExtractor) { return null;}\n" +
108
				"	public java.util.Comparator<*> thenComparingDouble(java.util.function.ToDoubleFunction<? super *> keyExtractor) { return null;}\n";
109
			COMPARATOR_RAW_IMPL_JRE8 =
110
				"	public java.util.Comparator reverseOrder() { return null;}\n" +
111
				"	public java.util.Comparator reversed() { return null;}\n" +
112
				"	public java.util.Comparator thenComparing(java.util.Comparator other) { return null;}\n" +
113
				"	public java.util.Comparator thenComparing(java.util.function.Function keyExtractor, java.util.Comparator keyComparator) { return null;}\n" +
114
				"	public java.util.Comparator thenComparing(java.util.function.Function keyExtractor) { return null;}\n" +
115
				"	public java.util.Comparator thenComparingInt(java.util.function.ToIntFunction keyExtractor) { return null;}\n" +
116
				"	public java.util.Comparator thenComparingLong(java.util.function.ToLongFunction keyExtractor) { return null;}\n" +
117
				"	public java.util.Comparator thenComparingDouble(java.util.function.ToDoubleFunction keyExtractor) { return null;}\n";
118
			COLLECTION_IMPL_JRE8 =
119
				"	public boolean removeAll(java.util.function.Predicate<? super *> filter) { return false;}\n" +
120
				"	public boolean removeIf(java.util.function.Predicate<? super *> filter) { return false;}\n" +
121
				"	public java.util.stream.Stream<*> stream() { return null;}\n" +
122
				"	public java.util.stream.Stream<*> parallelStream() { return null;}\n";
123
			COLLECTION_AND_LIST_IMPL_JRE8 =
124
				"	public boolean removeAll(java.util.function.Predicate<? super *> filter) { return false;}\n" +
125
				"	public boolean removeIf(java.util.function.Predicate<? super *> filter) { return false;}\n" +
126
				"	public java.util.stream.Stream<*> stream() { return null;}\n" +
127
				"	public java.util.stream.Stream<*> parallelStream() { return null;}\n" +
128
				"	public void sort(java.util.Comparator<? super *> comparator) {}\n" +
129
				"	public void parallelSort(java.util.Comparator<? super *> comparator) {}\n" +
130
				"	public void replaceAll(java.util.function.UnaryOperator<*> operator) {}\n";
131
			COLLECTION_RAW_IMPL_JRE8 =
132
				"	public @SuppressWarnings(\"rawtypes\") boolean removeAll(java.util.function.Predicate filter) { return false;}\n" +
133
				"	public @SuppressWarnings(\"rawtypes\") boolean removeIf(java.util.function.Predicate filter) { return false;}\n" +
134
				"	public @SuppressWarnings(\"rawtypes\") java.util.stream.Stream stream() { return null;}\n" +
135
				"	public @SuppressWarnings(\"rawtypes\") java.util.stream.Stream parallelStream() { return null;}\n";
136
			LIST_IMPL_JRE8 = // replace '*' with your concrete type argument
137
				"	public void sort(java.util.Comparator<? super *> comparator) {}\n" +
138
				"	public void parallelSort(java.util.Comparator<? super *> comparator) {}\n" +
139
				"	public void replaceAll(java.util.function.UnaryOperator<*> operator) {}\n";
140
			LIST_RAW_IMPL_JRE8 =
141
				"	public @SuppressWarnings(\"rawtypes\") void sort(java.util.Comparator comparator) {}\n" +
142
				"	public @SuppressWarnings(\"rawtypes\") void parallelSort(java.util.Comparator comparator) {}\n" +
143
				"	public @SuppressWarnings(\"rawtypes\") void replaceAll(java.util.function.UnaryOperator operator) {}\n";
144
			COLLECTION_AND_LIST_RAW_IMPL_JRE8 =
145
				"	public @SuppressWarnings(\"rawtypes\") boolean removeAll(java.util.function.Predicate filter) { return false;}\n" +
146
				"	public @SuppressWarnings(\"rawtypes\") boolean removeIf(java.util.function.Predicate filter) { return false;}\n" +
147
				"	public @SuppressWarnings(\"rawtypes\") java.util.stream.Stream stream() { return null;}\n" +
148
				"	public @SuppressWarnings(\"rawtypes\") java.util.stream.Stream parallelStream() { return null;}\n" +
149
				"	public @SuppressWarnings(\"rawtypes\") void sort(java.util.Comparator comparator) {}\n" +
150
				"	public @SuppressWarnings(\"rawtypes\") void parallelSort(java.util.Comparator comparator) {}\n" +
151
				"	public @SuppressWarnings(\"rawtypes\") void replaceAll(java.util.function.UnaryOperator operator) {}\n";
152
			ITERABLE_IMPL_JRE8 = // replace '*' with your concrete type argument
153
				"	public void forEach(java.util.function.Consumer<? super *> block){}\n" +
154
				"	public void forEachRemaining(java.util.function.Consumer<? super *> action) {}\n" +
155
				"	public java.util.Spliterator<*> spliterator() {return null;}\n";
156
			ITERABLE_RAW_IMPL_JRE8 =
157
				"	public @SuppressWarnings(\"rawtypes\") void forEach(java.util.function.Consumer action) {}\n" +
158
				"	public @SuppressWarnings(\"rawtypes\") void forEachRemaining(java.util.function.Consumer action) {}\n" +
159
				"	public @SuppressWarnings(\"rawtypes\") java.util.Spliterator spliterator() {return null;}\n";
160
			ITERATOR_IMPL_JRE8 = // replace '*' with your concrete type argument
161
					"public void forEach(java.util.function.Consumer<? super *> action) {}\n" +
162
					"public void forEachRemaining(java.util.function.Consumer<? super *> action) {}\n";
163
			ITERATOR_RAW_IMPL_JRE8 =
164
				"	public @SuppressWarnings(\"rawtypes\") void forEach(java.util.function.Consumer block) {}\n" +
165
				"	public @SuppressWarnings(\"rawtypes\") void forEachRemaining(java.util.function.Consumer action) {}\n";
166
			MAP_IMPL_JRE8 = // '*' for 'K', '%' for 'V'
167
				"	public boolean remove(Object key, Object value) { return false;}\n" +
168
				"	public % getOrDefault(Object key, % defaultValue) {return defaultValue;}\n" +
169
				"	public void forEach(java.util.function.BiConsumer<? super *, ? super %> block) {}\n" +
170
				"	public void replaceAll(java.util.function.BiFunction<? super *, ? super %, ? extends %> function) {}\n" +
171
				"	public % putIfAbsent(* key, % value) { return null;}\n" +
172
				"	public boolean replace(* key, % oldValue, % newValue) { return false;}\n" +
173
				"	public % replace(* key, % value) { return null;}\n" +
174
				"	public % computeIfAbsent(* key, java.util.function.Function<? super *, ? extends %> mappingFunction) { return null;}\n" +
175
				"	public % computeIfPresent(* key, java.util.function.BiFunction<? super *, ? super %, ? extends %> remappingFunction) { return null;}\n" +
176
				"	public % compute(* key, java.util.function.BiFunction<? super *, ? super %, ? extends %> remappingFunction) { return null;}\n" +
177
				"	public % merge(* key, % value, java.util.function.BiFunction<? super %, ? super %, ? extends %> remappingFunction) { return null;}\n";
178
			MAP_RAW_IMPL_JRE8 =
179
				"	public boolean remove(Object key, Object value) { return false;}\n" +
180
				"	public @SuppressWarnings(\"rawtypes\") Object getOrDefault(Object key, Object defaultValue) { return defaultValue;}\n" +
181
				"	public @SuppressWarnings(\"rawtypes\") void forEach(java.util.function.BiConsumer block) {}\n" +
182
				"	public @SuppressWarnings(\"rawtypes\") void replaceAll(java.util.function.BiFunction function) {}\n" +
183
				"	public Object putIfAbsent(Object key, Object value) { return null;}\n" +
184
				"	public boolean replace(Object key, Object oldValue, Object newValue) { return false;}\n" +
185
				"	public Object replace(Object key, Object value) { return null;}\n" +
186
				"	public @SuppressWarnings(\"rawtypes\") Object computeIfAbsent(Object key, java.util.function.Function mappingFunction) { return null;}\n" +
187
				"	public @SuppressWarnings(\"rawtypes\") Object computeIfPresent(Object key, java.util.function.BiFunction remappingFunction) { return null;}\n" +
188
				"	public @SuppressWarnings(\"rawtypes\") Object compute(Object key, java.util.function.BiFunction remappingFunction) { return null;}\n" +
189
				"	public @SuppressWarnings(\"rawtypes\") Object merge(Object key, Object value, java.util.function.BiFunction remappingFunction) { return null;}\n";
190
		} else {
191
			COMPARATOR_IMPL_JRE8 = "";			
192
			COMPARATOR_RAW_IMPL_JRE8 = "";
193
			COLLECTION_IMPL_JRE8 = "";
194
			COLLECTION_RAW_IMPL_JRE8 = "";
195
			LIST_IMPL_JRE8 = "";
196
			COLLECTION_AND_LIST_IMPL_JRE8 = "";
197
			COLLECTION_AND_LIST_RAW_IMPL_JRE8 = "";
198
			LIST_RAW_IMPL_JRE8 = "";
199
			ITERABLE_IMPL_JRE8 = "";
200
			ITERABLE_RAW_IMPL_JRE8 = "";
201
			ITERATOR_IMPL_JRE8 = "\n\n";
202
			ITERATOR_RAW_IMPL_JRE8 = "\n\n";
203
			MAP_IMPL_JRE8 = "";
204
			MAP_RAW_IMPL_JRE8 = "";
205
		}
206
	}
207
	String getCollectionAndListRawImplJRE8() {
208
		if (this.complianceLevel < ClassFileConstants.JDK1_5)
209
			return COLLECTION_AND_LIST_RAW_IMPL_JRE8.replaceAll("@SuppressWarnings\\(\"rawtypes\"\\)", "");
210
		return COLLECTION_AND_LIST_RAW_IMPL_JRE8;
211
	} 
212
	String getListRawImplJRE8() {
213
		if (this.complianceLevel < ClassFileConstants.JDK1_5)
214
			return LIST_RAW_IMPL_JRE8.replaceAll("@SuppressWarnings\\(\"rawtypes\"\\)", "");
215
		return LIST_RAW_IMPL_JRE8;
216
	}
217
	String getIterableRawImplJRE8() {
218
		if (this.complianceLevel < ClassFileConstants.JDK1_5)
219
			return ITERABLE_RAW_IMPL_JRE8.replaceAll("@SuppressWarnings\\(\"rawtypes\"\\)", "");
220
		return ITERABLE_RAW_IMPL_JRE8;
221
	}
222
	String getCollectionRawImplJRE8() {
223
		if (this.complianceLevel < ClassFileConstants.JDK1_5)
224
			return COLLECTION_RAW_IMPL_JRE8.replaceAll("@SuppressWarnings\\(\"rawtypes\"\\)", "");
225
		return COLLECTION_RAW_IMPL_JRE8;
226
	}
227
228
	// javac comparison related types, fields and methods - see runJavac for
79
	// javac comparison related types, fields and methods - see runJavac for
229
	// details
80
	// details
230
static class JavacCompiler {
81
static class JavacCompiler {
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-2 / +2 lines)
Lines 514-520 sure, yet neither overrides the other Link Here
514
						"}\n" +
514
						"}\n" +
515
						"interface OrderedSet<E> extends List<E>, Set<E> { boolean add(E o); }\n"
515
						"interface OrderedSet<E> extends List<E>, Set<E> { boolean add(E o); }\n"
516
		};
516
		};
517
		if (!IS_JRE_8 || this.complianceLevel < ClassFileConstants.JDK1_8)
517
		if (this.complianceLevel < ClassFileConstants.JDK1_8)
518
			this.runConformTest(testFiles, "");
518
			this.runConformTest(testFiles, "");
519
		else
519
		else
520
			this.runNegativeTest(
520
			this.runNegativeTest(
Lines 538-544 sure, yet neither overrides the other Link Here
538
	}
538
	}
539
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=123943 variant to make it pass on JRE8
539
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=123943 variant to make it pass on JRE8
540
	public void test009a() {
540
	public void test009a() {
541
		if (!IS_JRE_8 || this.complianceLevel < ClassFileConstants.JDK1_8)
541
		if (this.complianceLevel < ClassFileConstants.JDK1_8)
542
			return;
542
			return;
543
		this.runConformTest(
543
		this.runConformTest(
544
			new String[] {
544
			new String[] {
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ForeachStatementTest.java (-8 lines)
Lines 1106-1112 public void test023() { Link Here
1106
				"   public Iterator<String> iterator() {\n" +
1106
				"   public Iterator<String> iterator() {\n" +
1107
				"        return null;\n" +
1107
				"        return null;\n" +
1108
				"    }\n" +
1108
				"    }\n" +
1109
				ITERABLE_IMPL_JRE8.replaceAll("\\*", "String") +
1110
				"}\n",
1109
				"}\n",
1111
			},
1110
			},
1112
			"----------\n" +
1111
			"----------\n" +
Lines 1629-1641 public void test034() throws Exception { Link Here
1629
			"	}\n" +
1628
			"	}\n" +
1630
			"	public void remove() {\n" +
1629
			"	public void remove() {\n" +
1631
			"	}\n" +
1630
			"	}\n" +
1632
			ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") +
1633
			"}\n" +
1631
			"}\n" +
1634
			"class Bar implements Iterable<String> {\n" +
1632
			"class Bar implements Iterable<String> {\n" +
1635
			"	public Iterator<String> iterator() {\n" +
1633
			"	public Iterator<String> iterator() {\n" +
1636
			"		return new ArrayIterator<String>(new String[]{\"a\",\"b\"});\n" +
1634
			"		return new ArrayIterator<String>(new String[]{\"a\",\"b\"});\n" +
1637
			"	}\n" +
1635
			"	}\n" +
1638
			ITERABLE_IMPL_JRE8.replaceAll("\\*", "String") +
1639
			"}\n",
1636
			"}\n",
1640
		},
1637
		},
1641
		"ab");
1638
		"ab");
Lines 1724-1730 public void test035() throws Exception { Link Here
1724
			"	}\n" +
1721
			"	}\n" +
1725
			"	public void remove() {\n" +
1722
			"	public void remove() {\n" +
1726
			"	}\n" +
1723
			"	}\n" +
1727
			ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") +
1728
			"}\n" +
1724
			"}\n" +
1729
			"interface IFoo extends Iterable<String> {\n" +
1725
			"interface IFoo extends Iterable<String> {\n" +
1730
			"}\n" +
1726
			"}\n" +
Lines 1732-1738 public void test035() throws Exception { Link Here
1732
			"	public Iterator<String> iterator() {\n" +
1728
			"	public Iterator<String> iterator() {\n" +
1733
			"		return new ArrayIterator<String>(new String[]{\"a\",\"b\"});\n" +
1729
			"		return new ArrayIterator<String>(new String[]{\"a\",\"b\"});\n" +
1734
			"	}\n" +
1730
			"	}\n" +
1735
			ITERABLE_IMPL_JRE8.replaceAll("\\*", "String") +
1736
			"}\n",
1731
			"}\n",
1737
		},
1732
		},
1738
		"ab");
1733
		"ab");
Lines 1808-1814 public void test036() throws Exception { Link Here
1808
			"		X x = new X();\n" +
1803
			"		X x = new X();\n" +
1809
			"		x.foo(x);\n" +
1804
			"		x.foo(x);\n" +
1810
			"	}\n" +
1805
			"	}\n" +
1811
			ITERABLE_IMPL_JRE8.replaceAll("\\*", "String") +
1812
			"}",
1806
			"}",
1813
		},
1807
		},
1814
		"ab");
1808
		"ab");
Lines 2023-2029 public void test039() throws Exception { Link Here
2023
			"				System.out.println(\"remove\");\n" +
2017
			"				System.out.println(\"remove\");\n" +
2024
			"				this.iterator.remove();\n" +
2018
			"				this.iterator.remove();\n" +
2025
			"			}\n" +
2019
			"			}\n" +
2026
			ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") +
2027
			"		}\n" +
2020
			"		}\n" +
2028
			"		\n" +
2021
			"		\n" +
2029
			"        static Set<Object> initForEach()        {\n" +
2022
			"        static Set<Object> initForEach()        {\n" +
Lines 2120-2126 public void test040() throws Exception { Link Here
2120
			"				System.out.println(\"remove\");\n" +
2113
			"				System.out.println(\"remove\");\n" +
2121
			"				this.iterator.remove();\n" +
2114
			"				this.iterator.remove();\n" +
2122
			"			}\n" +
2115
			"			}\n" +
2123
			ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") +
2124
			"		}\n" +
2116
			"		}\n" +
2125
			"		\n" +
2117
			"		\n" +
2126
			"        static Set<Object> initForEach()        {\n" +
2118
			"        static Set<Object> initForEach()        {\n" +
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-29 / +8 lines)
Lines 4456-4463 public class GenericTypeTest extends AbstractComparableTest { Link Here
4456
				"    }\n" +
4456
				"    }\n" +
4457
				"    public int size() { return 0; }\n" +
4457
				"    public int size() { return 0; }\n" +
4458
				"    public Object get(int index) { return null; }\n" +
4458
				"    public Object get(int index) { return null; }\n" +
4459
				ITERABLE_RAW_IMPL_JRE8 +
4460
				COLLECTION_AND_LIST_RAW_IMPL_JRE8 +
4461
				"}\n"
4459
				"}\n"
4462
			},
4460
			},
4463
			"SUCCESS");
4461
			"SUCCESS");
Lines 6189-6195 public class GenericTypeTest extends AbstractComparableTest { Link Here
6189
				"    public int compare(X x1, X x2) {\n" +
6187
				"    public int compare(X x1, X x2) {\n" +
6190
				"        return comparator.compare(function.eval(x1),function.eval(x2));\n" +
6188
				"        return comparator.compare(function.eval(x1),function.eval(x2));\n" +
6191
				"    }\n" +
6189
				"    }\n" +
6192
				COMPARATOR_RAW_IMPL_JRE8 +
6193
				"}\n",
6190
				"}\n",
6194
			},
6191
			},
6195
			"");
6192
			"");
Lines 8890-8896 public class GenericTypeTest extends AbstractComparableTest { Link Here
8890
				"   public Set<Map.Entry<String, V>> entrySet() {\n" +
8887
				"   public Set<Map.Entry<String, V>> entrySet() {\n" +
8891
				"      return this.backingMap.entrySet();\n" +
8888
				"      return this.backingMap.entrySet();\n" +
8892
				"   }\n" +
8889
				"   }\n" +
8893
				MAP_IMPL_JRE8.replaceAll("\\*", "String").replaceAll("\\%", "V")+
8894
				"}\n",
8890
				"}\n",
8895
			},
8891
			},
8896
			"----------\n" +
8892
			"----------\n" +
Lines 10850-10861 public class GenericTypeTest extends AbstractComparableTest { Link Here
10850
					"			public boolean hasNext() {return false;}\n" +
10846
					"			public boolean hasNext() {return false;}\n" +
10851
					"			public Entry<String, Integer> next() {return null;}\n" +
10847
					"			public Entry<String, Integer> next() {return null;}\n" +
10852
					"			public void remove() {}	\n" +
10848
					"			public void remove() {}	\n" +
10853
					ITERATOR_IMPL_JRE8.replaceAll("\\*", "Entry<String,Integer>") +
10854
					"		};\n" +
10849
					"		};\n" +
10855
					"	}\n" +
10850
					"	}\n" +
10856
					"	public int size() {return 0;}\n" +
10851
					"	public int size() {return 0;}\n" +
10857
					COLLECTION_RAW_IMPL_JRE8 +
10858
					ITERABLE_IMPL_JRE8.replaceAll("\\*", "Entry<String,Integer>") +
10859
					"}"
10852
					"}"
10860
			}
10853
			}
10861
		);
10854
		);
Lines 11427-11434 public class GenericTypeTest extends AbstractComparableTest { Link Here
11427
				"    }\n" +
11420
				"    }\n" +
11428
				"    public Iterator<Runnable> iterator() {return null;}\n" +
11421
				"    public Iterator<Runnable> iterator() {return null;}\n" +
11429
				"    public int size() {return 0;}\n" +
11422
				"    public int size() {return 0;}\n" +
11430
				COLLECTION_RAW_IMPL_JRE8 +
11431
				ITERABLE_IMPL_JRE8.replaceAll("\\*", "Runnable") +
11432
				"}"
11423
				"}"
11433
				}
11424
				}
11434
		);
11425
		);
Lines 13608-13614 public class GenericTypeTest extends AbstractComparableTest { Link Here
13608
				"    public boolean hasNext() { return false; }\n" +
13599
				"    public boolean hasNext() { return false; }\n" +
13609
				"    public String next() { return null; }\n" +
13600
				"    public String next() { return null; }\n" +
13610
				"    public void remove() {}\n" +
13601
				"    public void remove() {}\n" +
13611
				ITERATOR_IMPL_JRE8.replaceAll("\\*", "String") +
13612
				"}\n",
13602
				"}\n",
13613
			},
13603
			},
13614
			"");
13604
			"");
Lines 20044-20050 public void test0617() { Link Here
20044
				"			}\n" +
20034
				"			}\n" +
20045
				"			public void remove() {\n" +
20035
				"			public void remove() {\n" +
20046
				"			}\n" +
20036
				"			}\n" +
20047
				ITERATOR_IMPL_JRE8.replaceAll("\\*", "U") +
20048
				"		}\n" +
20037
				"		}\n" +
20049
				"	}\n" +
20038
				"	}\n" +
20050
				"}\n",
20039
				"}\n",
Lines 25082-25089 public void test0779() throws Exception { Link Here
25082
			"			List<String> list = new AbstractList<String>() {\n" +
25071
			"			List<String> list = new AbstractList<String>() {\n" +
25083
			"				@Override public int size() { return 0; }\n" +
25072
			"				@Override public int size() { return 0; }\n" +
25084
			"				@Override public String get(int i) { return args.get(i); }\n" +
25073
			"				@Override public String get(int i) { return args.get(i); }\n" +
25085
			COLLECTION_AND_LIST_IMPL_JRE8.replaceAll("\\*", "String") +
25086
			ITERABLE_IMPL_JRE8.replaceAll("\\*", "String") +
25087
			"			};\n" +
25074
			"			};\n" +
25088
			"		}\n" +
25075
			"		}\n" +
25089
			"	}\n" +
25076
			"	}\n" +
Lines 25095-25108 public void test0779() throws Exception { Link Here
25095
		},
25082
		},
25096
		"SUCCESS");
25083
		"SUCCESS");
25097
25084
25098
	String constantPoolIdx = IS_JRE_8 ? "73" : "36"; // depends on whether or not stubs for JRE8 default methods are included
25099
	String expectedOutput =
25085
	String expectedOutput =
25100
		"  // Method descriptor #31 (I)Ljava/lang/Object;\n" +
25086
		"  // Method descriptor #31 (I)Ljava/lang/Object;\n" +
25101
		"  // Stack: 2, Locals: 2\n" +
25087
		"  // Stack: 2, Locals: 2\n" +
25102
		"  public bridge synthetic java.lang.Object get(int arg0);\n" +
25088
		"  public bridge synthetic java.lang.Object get(int arg0);\n" +
25103
		"    0  aload_0 [this]\n" +
25089
		"    0  aload_0 [this]\n" +
25104
		"    1  iload_1 [arg0]\n" +
25090
		"    1  iload_1 [arg0]\n" +
25105
		"    2  invokevirtual X$Entry$1.get(int) : java.lang.String ["+constantPoolIdx+"]\n" +
25091
		"    2  invokevirtual X$Entry$1.get(int) : java.lang.String [36]\n" +
25106
		"    5  areturn\n" +
25092
		"    5  areturn\n" +
25107
		"      Line numbers:\n" +
25093
		"      Line numbers:\n" +
25108
		"        [pc: 0, line: 1]\n";
25094
		"        [pc: 0, line: 1]\n";
Lines 26172-26178 public void test0809() { Link Here
26172
			"	}\n" +
26158
			"	}\n" +
26173
			"	public void remove() {\n" +
26159
			"	public void remove() {\n" +
26174
			"	}\n" +
26160
			"	}\n" +
26175
			ITERATOR_IMPL_JRE8.replaceAll("\\*", "N") +
26176
			"}\n" +
26161
			"}\n" +
26177
			"interface Set3<N extends Node> extends Iterable<N> {\n" +
26162
			"interface Set3<N extends Node> extends Iterable<N> {\n" +
26178
			"	SetIterator<N> iterator();\n" +
26163
			"	SetIterator<N> iterator();\n" +
Lines 26204-26230 public void test0809() { Link Here
26204
			"}\n",
26189
			"}\n",
26205
		},
26190
		},
26206
		"----------\n" +
26191
		"----------\n" +
26207
		"1. WARNING in X.java (at line 23)\n" +
26192
		"1. WARNING in X.java (at line 21)\n" +
26208
		"	void f1(Set1 s) {\n" +
26193
		"	void f1(Set1 s) {\n" +
26209
		"	        ^^^^\n" +
26194
		"	        ^^^^\n" +
26210
		"Set1 is a raw type. References to generic type Set1<N> should be parameterized\n" +
26195
		"Set1 is a raw type. References to generic type Set1<N> should be parameterized\n" +
26211
		"----------\n" +
26196
		"----------\n" +
26212
		"2. ERROR in X.java (at line 24)\n" +
26197
		"2. ERROR in X.java (at line 22)\n" +
26213
		"	Node n_ = s.iterator().next();\n" +
26198
		"	Node n_ = s.iterator().next();\n" +
26214
		"	          ^^^^^^^^^^^^^^^^^^^\n" +
26199
		"	          ^^^^^^^^^^^^^^^^^^^\n" +
26215
		"Type mismatch: cannot convert from Object to Node\n" +
26200
		"Type mismatch: cannot convert from Object to Node\n" +
26216
		"----------\n" +
26201
		"----------\n" +
26217
		"3. ERROR in X.java (at line 27)\n" +
26202
		"3. ERROR in X.java (at line 25)\n" +
26218
		"	for (Node n : s) {\n" +
26203
		"	for (Node n : s) {\n" +
26219
		"	              ^\n" +
26204
		"	              ^\n" +
26220
		"Type mismatch: cannot convert from element type Object to Node\n" +
26205
		"Type mismatch: cannot convert from element type Object to Node\n" +
26221
		"----------\n" +
26206
		"----------\n" +
26222
		"4. WARNING in X.java (at line 37)\n" +
26207
		"4. WARNING in X.java (at line 35)\n" +
26223
		"	void f3(Set3 s) {\n" +
26208
		"	void f3(Set3 s) {\n" +
26224
		"	        ^^^^\n" +
26209
		"	        ^^^^\n" +
26225
		"Set3 is a raw type. References to generic type Set3<N> should be parameterized\n" +
26210
		"Set3 is a raw type. References to generic type Set3<N> should be parameterized\n" +
26226
		"----------\n" +
26211
		"----------\n" +
26227
		"5. ERROR in X.java (at line 40)\n" +
26212
		"5. ERROR in X.java (at line 38)\n" +
26228
		"	for (Node n : s) {\n" +
26213
		"	for (Node n : s) {\n" +
26229
		"	              ^\n" +
26214
		"	              ^\n" +
26230
		"Type mismatch: cannot convert from element type Object to Node\n" +
26215
		"Type mismatch: cannot convert from element type Object to Node\n" +
Lines 28413-28420 public void test0868() { Link Here
28413
			"		// TODO Auto-generated method stub\n" +
28398
			"		// TODO Auto-generated method stub\n" +
28414
			"		\n" +
28399
			"		\n" +
28415
			"	}" +
28400
			"	}" +
28416
			COLLECTION_RAW_IMPL_JRE8 +
28417
			ITERABLE_RAW_IMPL_JRE8 +
28418
			"}",
28401
			"}",
28419
		},
28402
		},
28420
		"",
28403
		"",
Lines 34741-34747 public void test1030() { Link Here
34741
			"		public Iterator<W> iterator() {\n" +
34724
			"		public Iterator<W> iterator() {\n" +
34742
			"			return theList.iterator();\n" +
34725
			"			return theList.iterator();\n" +
34743
			"		}\n" +
34726
			"		}\n" +
34744
			ITERABLE_IMPL_JRE8.replace('*', 'W') +
34745
			"	}\n" +
34727
			"	}\n" +
34746
			"\n" +
34728
			"\n" +
34747
			"	private PointList<Waypoint> waypoints = new PointList<Waypoint>();\n" +
34729
			"	private PointList<Waypoint> waypoints = new PointList<Waypoint>();\n" +
Lines 34995-35001 public void test1035() { Link Here
34995
			"public int compare(T obj1, T obj2) {\n" +
34977
			"public int compare(T obj1, T obj2) {\n" +
34996
			"	return obj1.compareTo(obj2);\n" +
34978
			"	return obj1.compareTo(obj2);\n" +
34997
			"}\n" +
34979
			"}\n" +
34998
			COMPARATOR_IMPL_JRE8.replace('*', 'T').replace('%', 'U').replace('$', 'S') +
34999
			"}\n" +
34980
			"}\n" +
35000
			"\n" +
34981
			"\n" +
35001
			"@SuppressWarnings({\"unchecked\", \"rawtypes\"})\n" +
34982
			"@SuppressWarnings({\"unchecked\", \"rawtypes\"})\n" +
Lines 35046-35052 public void test1035() { Link Here
35046
			"public int compare(V obj1, V obj2) {\n" +
35027
			"public int compare(V obj1, V obj2) {\n" +
35047
			"	return 0;\n" +
35028
			"	return 0;\n" +
35048
			"}\n" +
35029
			"}\n" +
35049
			COMPARATOR_IMPL_JRE8.replace('*', 'V').replace('%', 'U').replace('$', 'S') +
35050
			"}", // =================
35030
			"}", // =================
35051
35031
35052
		});
35032
		});
Lines 50714-50720 public void test1444() { Link Here
50714
				"			public boolean hasNext() {\n" + 
50694
				"			public boolean hasNext() {\n" + 
50715
				"				return false;\n" + 
50695
				"				return false;\n" + 
50716
				"			}\n" + 
50696
				"			}\n" + 
50717
				ITERATOR_RAW_IMPL_JRE8 +
50718
				"		};\n" + 
50697
				"		};\n" + 
50719
				"	}\n" + 
50698
				"	}\n" + 
50720
				"	Zork z;\n" +
50699
				"	Zork z;\n" +
Lines 50747-50755 public void test1444() { Link Here
50747
			"	                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50726
			"	                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
50748
			"Unnecessary cast from Iterator to Iterator<String>\n" + 
50727
			"Unnecessary cast from Iterator to Iterator<String>\n" + 
50749
			"----------\n" + 
50728
			"----------\n" + 
50750
			"6. ERROR in X.java (at line 38)\n"
50729
			"6. ERROR in X.java (at line 36)\n"
50751
			: // secondary error no longer reported at 1.8+
50730
			: // secondary error no longer reported at 1.8+
50752
			"5. ERROR in X.java (at line 38)\n"
50731
			"5. ERROR in X.java (at line 36)\n"
50753
			) +
50732
			) +
50754
			"	Zork z;\n" + 
50733
			"	Zork z;\n" + 
50755
			"	^^^^\n" + 
50734
			"	^^^^\n" + 
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (-2 lines)
Lines 6858-6864 public void test173() throws Exception { Link Here
6858
			"				compare(yourList != null ? yourList : myList, yourList);\n" + 
6858
			"				compare(yourList != null ? yourList : myList, yourList);\n" + 
6859
			"				return 0;\n" + 
6859
			"				return 0;\n" + 
6860
			"			}\n" + 
6860
			"			}\n" + 
6861
			COMPARATOR_RAW_IMPL_JRE8 +
6862
			"		};\n" + 
6861
			"		};\n" + 
6863
			"		System.out.println(\"SUCCESS\");\n" + 
6862
			"		System.out.println(\"SUCCESS\");\n" + 
6864
			"	}\n" + 
6863
			"	}\n" + 
Lines 6889-6895 public void test174() throws Exception { Link Here
6889
			"			private int foo(int i, int j) {\n" + 
6888
			"			private int foo(int i, int j) {\n" + 
6890
			"				return i - j;\n" + 
6889
			"				return i - j;\n" + 
6891
			"			}\n" + 
6890
			"			}\n" + 
6892
			COMPARATOR_RAW_IMPL_JRE8 +
6893
			"		};\n" + 
6891
			"		};\n" + 
6894
			"		System.out.println(\"SUCCESS\");\n" + 
6892
			"		System.out.println(\"SUCCESS\");\n" + 
6895
			"	}\n" + 
6893
			"	}\n" + 
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java (-3 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
2
 * Copyright (c) 2000, 2014 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 2563-2570 public void test075() { Link Here
2563
				"        public int size() {\n" +
2563
				"        public int size() {\n" +
2564
				"                return 0;\n" +
2564
				"                return 0;\n" +
2565
				"        }\n" +
2565
				"        }\n" +
2566
				getCollectionAndListRawImplJRE8() +
2567
				getIterableRawImplJRE8() +
2568
				"}", // =================
2566
				"}", // =================
2569
			},
2567
			},
2570
			"");
2568
			"");
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-10 lines)
Lines 1825-1831 public class MethodVerifyTest extends AbstractComparableTest { Link Here
1825
				"import java.util.*;\n" + 
1825
				"import java.util.*;\n" + 
1826
				"public class X extends java.util.AbstractMap {\n" +
1826
				"public class X extends java.util.AbstractMap {\n" +
1827
				"	public java.util.Set entrySet() { return null; }\n" +
1827
				"	public java.util.Set entrySet() { return null; }\n" +
1828
				MAP_RAW_IMPL_JRE8 +
1829
				"}\n"
1828
				"}\n"
1830
			},
1829
			},
1831
			""
1830
			""
Lines 6900-6907 X.java:7: name clash: <T#1>foo2(T#1) in X and <T#2>foo2(A) in Y have the same er Link Here
6900
				"	public boolean hasNext() {	return false; }\n" +
6899
				"	public boolean hasNext() {	return false; }\n" +
6901
				"	public Object next() {	return null; }\n" +
6900
				"	public Object next() {	return null; }\n" +
6902
				"	public void remove() {}\n" +
6901
				"	public void remove() {}\n" +
6903
				ITERABLE_RAW_IMPL_JRE8 +
6904
				COLLECTION_AND_LIST_RAW_IMPL_JRE8 +
6905
				"}\n", // =================
6902
				"}\n", // =================
6906
			},
6903
			},
6907
			"----------\n" +
6904
			"----------\n" +
Lines 7022-7029 X.java:7: name clash: <T#1>foo2(T#1) in X and <T#2>foo2(A) in Y have the same er Link Here
7022
				"	public boolean hasNext() {	return false; }\n" +
7019
				"	public boolean hasNext() {	return false; }\n" +
7023
				"	public Object next() {	return null; }\n" +
7020
				"	public Object next() {	return null; }\n" +
7024
				"	public void remove() {}\n" +
7021
				"	public void remove() {}\n" +
7025
				ITERABLE_RAW_IMPL_JRE8 +
7026
				COLLECTION_AND_LIST_RAW_IMPL_JRE8 +
7027
				"}\n", // =================
7022
				"}\n", // =================
7028
			},
7023
			},
7029
			"----------\n" +
7024
			"----------\n" +
Lines 7134-7141 X.java:7: name clash: <T#1>foo2(T#1) in X and <T#2>foo2(A) in Y have the same er Link Here
7134
				"	public boolean hasNext() {	return false; }\n" +
7129
				"	public boolean hasNext() {	return false; }\n" +
7135
				"	public Object next() {	return null; }\n" +
7130
				"	public Object next() {	return null; }\n" +
7136
				"	public void remove() {}\n" +
7131
				"	public void remove() {}\n" +
7137
				ITERABLE_RAW_IMPL_JRE8 +
7138
				COLLECTION_AND_LIST_RAW_IMPL_JRE8 + 
7139
				"}\n", // =================
7132
				"}\n", // =================
7140
			},
7133
			},
7141
			"----------\n" +
7134
			"----------\n" +
Lines 11442-11448 public void test203() { Link Here
11442
			"		return compare((I) o1, (I) o2);\n" +
11435
			"		return compare((I) o1, (I) o2);\n" +
11443
			"	}\n" +
11436
			"	}\n" +
11444
			"	public int compare(I o1, I o2) { return 0; }\n" +
11437
			"	public int compare(I o1, I o2) { return 0; }\n" +
11445
			COMPARATOR_RAW_IMPL_JRE8 +
11446
			"}"
11438
			"}"
11447
		},
11439
		},
11448
		""
11440
		""
Lines 12355-12361 public void test331446() { Link Here
12355
			"			public int compare(Object o1, Object o2) {\n" + 
12347
			"			public int compare(Object o1, Object o2) {\n" + 
12356
			"				return 0;\n" + 
12348
			"				return 0;\n" + 
12357
			"			}\n" + 
12349
			"			}\n" + 
12358
			COMPARATOR_RAW_IMPL_JRE8 +
12359
			"		};\n" + 
12350
			"		};\n" + 
12360
			"		Test.assertEquals(\"Test\", comparator, new ArrayList(), new ArrayList());\n" + 
12351
			"		Test.assertEquals(\"Test\", comparator, new ArrayList(), new ArrayList());\n" + 
12361
			"	}\n" + 
12352
			"	}\n" + 
Lines 12426-12432 public void test331446a() { Link Here
12426
			"			public int compare(Object o1, Object o2) {\n" + 
12417
			"			public int compare(Object o1, Object o2) {\n" + 
12427
			"				return 0;\n" + 
12418
			"				return 0;\n" + 
12428
			"			}\n" + 
12419
			"			}\n" + 
12429
			COMPARATOR_RAW_IMPL_JRE8 +
12430
			"		};\n" + 
12420
			"		};\n" + 
12431
			"		Test.assertEquals(\"Test\", comparator, new ArrayList(), new ArrayList());\n" + 
12421
			"		Test.assertEquals(\"Test\", comparator, new ArrayList(), new ArrayList());\n" + 
12432
			"	}\n" + 
12422
			"	}\n" + 
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/StackMapAttributeTest.java (-2 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2006, 2013 IBM Corporation and others.
2
 * Copyright (c) 2006, 2014 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1788-1794 public class StackMapAttributeTest extends AbstractRegressionTest { Link Here
1788
            		"    public Iterator<Value_Type> iterator() {\n" +
1788
            		"    public Iterator<Value_Type> iterator() {\n" +
1789
            		"        return null;\n" +
1789
            		"        return null;\n" +
1790
            		"    }\n" +
1790
            		"    }\n" +
1791
            		ITERABLE_IMPL_JRE8.replaceAll("\\*", "Value_Type") +
1792
            		"}\n" +
1791
            		"}\n" +
1793
            		"\n" +
1792
            		"\n" +
1794
            		"class BirBlock {\n" +
1793
            		"class BirBlock {\n" +
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/VarargsTest.java (-3 / +2 lines)
Lines 2494-2500 public class VarargsTest extends AbstractComparableTest { Link Here
2494
					"        public void remove() {\n" +
2494
					"        public void remove() {\n" +
2495
					"            throw new UnsupportedOperationException();\n" +
2495
					"            throw new UnsupportedOperationException();\n" +
2496
					"        }\n" +
2496
					"        }\n" +
2497
					ITERATOR_IMPL_JRE8.replaceAll("\\*", "T") +
2498
					"    }\n" +
2497
					"    }\n" +
2499
					"    public static void main(String[] args) {\n" +
2498
					"    public static void main(String[] args) {\n" +
2500
					"        new IteratorChain<Number>(null, null);\n" +
2499
					"        new IteratorChain<Number>(null, null);\n" +
Lines 2503-2509 public class VarargsTest extends AbstractComparableTest { Link Here
2503
				},
2502
				},
2504
				this.complianceLevel < ClassFileConstants.JDK1_7 ?
2503
				this.complianceLevel < ClassFileConstants.JDK1_7 ?
2505
				"----------\n" + 
2504
				"----------\n" + 
2506
				"1. WARNING in X.java (at line 20)\n" + 
2505
				"1. WARNING in X.java (at line 18)\n" + 
2507
				"	new IteratorChain<Number>(null, null);\n" + 
2506
				"	new IteratorChain<Number>(null, null);\n" + 
2508
				"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
2507
				"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
2509
				"Type safety: A generic array of Collection<? extends Number> is created for a varargs parameter\n" + 
2508
				"Type safety: A generic array of Collection<? extends Number> is created for a varargs parameter\n" + 
Lines 2514-2520 public class VarargsTest extends AbstractComparableTest { Link Here
2514
				"	                                                                                                       ^^^^^^^^^^^\n" + 
2513
				"	                                                                                                       ^^^^^^^^^^^\n" + 
2515
				"Type safety: Potential heap pollution via varargs parameter collections\n" + 
2514
				"Type safety: Potential heap pollution via varargs parameter collections\n" + 
2516
				"----------\n" + 
2515
				"----------\n" + 
2517
				"2. WARNING in X.java (at line 20)\n" + 
2516
				"2. WARNING in X.java (at line 18)\n" + 
2518
				"	new IteratorChain<Number>(null, null);\n" + 
2517
				"	new IteratorChain<Number>(null, null);\n" + 
2519
				"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
2518
				"	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
2520
				"Type safety: A generic array of Collection<? extends Number> is created for a varargs parameter\n" + 
2519
				"Type safety: A generic array of Collection<? extends Number> is created for a varargs parameter\n" + 

Return to bug 431911