Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 400977 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/CompilerInvocationTests.java (-2 / +6 lines)
Lines 510-515 Link Here
510
		expectedProblemAttributes.put("HierarchyCircularitySelfReference", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
510
		expectedProblemAttributes.put("HierarchyCircularitySelfReference", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
511
		expectedProblemAttributes.put("HierarchyHasProblems", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
511
		expectedProblemAttributes.put("HierarchyHasProblems", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
512
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
512
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
513
		expectedProblemAttributes.put("IllegalAbstractStrictfpModifierCombinationForInterfaceMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
513
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
514
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
514
		expectedProblemAttributes.put("IllegalAnnotationForBaseType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
515
		expectedProblemAttributes.put("IllegalAnnotationForBaseType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
515
		expectedProblemAttributes.put("IllegalCast", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
516
		expectedProblemAttributes.put("IllegalCast", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 527-532 Link Here
527
		expectedProblemAttributes.put("IllegalBasetypeInIntersectionCast", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
528
		expectedProblemAttributes.put("IllegalBasetypeInIntersectionCast", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
528
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
529
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
529
		expectedProblemAttributes.put("IllegalModifierCombinationFinalVolatileForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
530
		expectedProblemAttributes.put("IllegalModifierCombinationFinalVolatileForField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
531
		expectedProblemAttributes.put("IllegalModifierCombinationForInterfaceMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
530
		expectedProblemAttributes.put("IllegalModifierForAnnotationField", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
532
		expectedProblemAttributes.put("IllegalModifierForAnnotationField", new ProblemAttributes(CategorizedProblem.CAT_INTERNAL));
531
		expectedProblemAttributes.put("IllegalModifierForAnnotationMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
533
		expectedProblemAttributes.put("IllegalModifierForAnnotationMemberType", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
532
		expectedProblemAttributes.put("IllegalModifierForAnnotationMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
534
		expectedProblemAttributes.put("IllegalModifierForAnnotationMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
Lines 541-547 Link Here
541
		expectedProblemAttributes.put("IllegalModifierForInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
543
		expectedProblemAttributes.put("IllegalModifierForInterface", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
542
		expectedProblemAttributes.put("IllegalModifierForInterfaceField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
544
		expectedProblemAttributes.put("IllegalModifierForInterfaceField", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
543
		expectedProblemAttributes.put("IllegalModifierForInterfaceMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
545
		expectedProblemAttributes.put("IllegalModifierForInterfaceMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
544
		expectedProblemAttributes.put("IllegalModifierForInterfaceDefaultMethod", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
546
		expectedProblemAttributes.put("IllegalModifierForInterfaceMethod18", new ProblemAttributes(CategorizedProblem.CAT_MEMBER));
545
		expectedProblemAttributes.put("IllegalModifierForLocalClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
547
		expectedProblemAttributes.put("IllegalModifierForLocalClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
546
		expectedProblemAttributes.put("IllegalModifierForLocalEnum", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
548
		expectedProblemAttributes.put("IllegalModifierForLocalEnum", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
547
		expectedProblemAttributes.put("IllegalModifierForMemberClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
549
		expectedProblemAttributes.put("IllegalModifierForMemberClass", new ProblemAttributes(CategorizedProblem.CAT_TYPE));
Lines 1292-1297 Link Here
1292
		expectedProblemAttributes.put("HierarchyCircularitySelfReference", SKIP);
1294
		expectedProblemAttributes.put("HierarchyCircularitySelfReference", SKIP);
1293
		expectedProblemAttributes.put("HierarchyHasProblems", SKIP);
1295
		expectedProblemAttributes.put("HierarchyHasProblems", SKIP);
1294
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", SKIP);
1296
		expectedProblemAttributes.put("IllegalAbstractModifierCombinationForMethod", SKIP);
1297
		expectedProblemAttributes.put("IllegalAbstractStrictfpModifierCombinationForInterfaceMethod", SKIP);
1295
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", SKIP);
1298
		expectedProblemAttributes.put("IllegalAccessFromTypeVariable", SKIP);
1296
		expectedProblemAttributes.put("IllegalAnnotationForBaseType", SKIP);
1299
		expectedProblemAttributes.put("IllegalAnnotationForBaseType", SKIP);
1297
		expectedProblemAttributes.put("IllegalCast", SKIP);
1300
		expectedProblemAttributes.put("IllegalCast", SKIP);
Lines 1309-1314 Link Here
1309
		expectedProblemAttributes.put("IllegalBasetypeInIntersectionCast", SKIP);
1312
		expectedProblemAttributes.put("IllegalBasetypeInIntersectionCast", SKIP);
1310
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", SKIP);
1313
		expectedProblemAttributes.put("IllegalModifierCombinationFinalAbstractForClass", SKIP);
1311
		expectedProblemAttributes.put("IllegalModifierCombinationFinalVolatileForField", SKIP);
1314
		expectedProblemAttributes.put("IllegalModifierCombinationFinalVolatileForField", SKIP);
1315
		expectedProblemAttributes.put("IllegalModifierCombinationForInterfaceMethod", SKIP);
1312
		expectedProblemAttributes.put("IllegalModifierForAnnotationField", SKIP);
1316
		expectedProblemAttributes.put("IllegalModifierForAnnotationField", SKIP);
1313
		expectedProblemAttributes.put("IllegalModifierForAnnotationMemberType", SKIP);
1317
		expectedProblemAttributes.put("IllegalModifierForAnnotationMemberType", SKIP);
1314
		expectedProblemAttributes.put("IllegalModifierForAnnotationMethod", SKIP);
1318
		expectedProblemAttributes.put("IllegalModifierForAnnotationMethod", SKIP);
Lines 1323-1329 Link Here
1323
		expectedProblemAttributes.put("IllegalModifierForInterface", SKIP);
1327
		expectedProblemAttributes.put("IllegalModifierForInterface", SKIP);
1324
		expectedProblemAttributes.put("IllegalModifierForInterfaceField", SKIP);
1328
		expectedProblemAttributes.put("IllegalModifierForInterfaceField", SKIP);
1325
		expectedProblemAttributes.put("IllegalModifierForInterfaceMethod", SKIP);
1329
		expectedProblemAttributes.put("IllegalModifierForInterfaceMethod", SKIP);
1326
		expectedProblemAttributes.put("IllegalModifierForInterfaceDefaultMethod", SKIP);
1330
		expectedProblemAttributes.put("IllegalModifierForInterfaceMethod18", SKIP);
1327
		expectedProblemAttributes.put("IllegalModifierForLocalClass", SKIP);
1331
		expectedProblemAttributes.put("IllegalModifierForLocalClass", SKIP);
1328
		expectedProblemAttributes.put("IllegalModifierForLocalEnum", SKIP);
1332
		expectedProblemAttributes.put("IllegalModifierForLocalEnum", SKIP);
1329
		expectedProblemAttributes.put("IllegalModifierForMemberClass", SKIP);
1333
		expectedProblemAttributes.put("IllegalModifierForMemberClass", SKIP);
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InterfaceMethodsTest.java (-19 / +62 lines)
Lines 83-99 Link Here
83
			"1. ERROR in I.java (at line 5)\n" + 
83
			"1. ERROR in I.java (at line 5)\n" + 
84
			"	public default synchronized void foo2() { System.exit(0); }\n" + 
84
			"	public default synchronized void foo2() { System.exit(0); }\n" + 
85
			"	                                 ^^^^^^\n" + 
85
			"	                                 ^^^^^^\n" + 
86
			"Illegal modifier for the interface method foo2; only public, abstract and strictfp are permitted\n" + 
86
			"Illegal modifier for the interface method foo2; only public, abstract, static, default and strictfp are permitted\n" + 
87
			"----------\n" + 
87
			"----------\n" + 
88
			"2. ERROR in I.java (at line 7)\n" + 
88
			"2. ERROR in I.java (at line 7)\n" + 
89
			"	public default strictfp synchronized void foo4() {}\n" + 
89
			"	public default strictfp synchronized void foo4() {}\n" + 
90
			"	                                          ^^^^^^\n" + 
90
			"	                                          ^^^^^^\n" + 
91
			"Illegal modifier for the interface method foo4; only public, abstract and strictfp are permitted\n" + 
91
			"Illegal modifier for the interface method foo4; only public, abstract, static, default and strictfp are permitted\n" + 
92
			"----------\n" + 
92
			"----------\n" + 
93
			"3. ERROR in I.java (at line 8)\n" + 
93
			"3. ERROR in I.java (at line 8)\n" + 
94
			"	public default strictfp synchronized @Annot void foo5() {}\n" + 
94
			"	public default strictfp synchronized @Annot void foo5() {}\n" + 
95
			"	                                                 ^^^^^^\n" + 
95
			"	                                                 ^^^^^^\n" + 
96
			"Illegal modifier for the interface method foo5; only public, abstract and strictfp are permitted\n" + 
96
			"Illegal modifier for the interface method foo5; only public, abstract, static, default and strictfp are permitted\n" + 
97
			"----------\n");
97
			"----------\n");
98
	}
98
	}
99
99
Lines 148-169 Link Here
148
			"1. ERROR in I.java (at line 5)\n" +
148
			"1. ERROR in I.java (at line 5)\n" +
149
			"	public synchronized void foo2();\n" +
149
			"	public synchronized void foo2();\n" +
150
			"	                         ^^^^^^\n" +
150
			"	                         ^^^^^^\n" +
151
			"Illegal modifier for the interface method foo2; only public & abstract are permitted\n" +
151
			"Illegal modifier for the interface method foo2; only public, abstract, static, default and strictfp are permitted\n" +
152
			"----------\n" +
152
			"----------\n" +
153
			"2. ERROR in I.java (at line 6)\n" +
153
			"2. ERROR in I.java (at line 6)\n" +
154
			"	strictfp void foo3();\n" +
154
			"	strictfp void foo3();\n" +
155
			"	              ^^^^^^\n" +
155
			"	              ^^^^^^\n" +
156
			"Illegal modifier for the interface method foo3; only public & abstract are permitted\n" +
156
			"Illegal modifiers for the interface method foo3; strictfp is not permitted for abstract interface method foo3\n" +
157
			"----------\n" +
157
			"----------\n" +
158
			"3. ERROR in I.java (at line 7)\n" +
158
			"3. ERROR in I.java (at line 7)\n" +
159
			"	public strictfp synchronized void foo4();\n" +
159
			"	public strictfp synchronized void foo4();\n" +
160
			"	                                  ^^^^^^\n" +
160
			"	                                  ^^^^^^\n" +
161
			"Illegal modifier for the interface method foo4; only public & abstract are permitted\n" +
161
			"Illegal modifiers for the interface method foo4; strictfp is not permitted for abstract interface method foo4\n" +
162
			"----------\n" +
162
			"----------\n" +
163
			"4. ERROR in I.java (at line 8)\n" +
163
			"4. ERROR in I.java (at line 7)\n" +
164
			"	public strictfp synchronized void foo4();\n" +
165
			"	                                  ^^^^^^\n" +
166
			"Illegal modifier for the interface method foo4; only public, abstract, static, default and strictfp are permitted\n" +
167
			"----------\n" +
168
			"5. ERROR in I.java (at line 8)\n" +
164
			"	public strictfp synchronized @Annot void foo5();\n" +
169
			"	public strictfp synchronized @Annot void foo5();\n" +
165
			"	                                         ^^^^^^\n" +
170
			"	                                         ^^^^^^\n" +
166
			"Illegal modifier for the interface method foo5; only public & abstract are permitted\n" +
171
			"Illegal modifiers for the interface method foo5; strictfp is not permitted for abstract interface method foo5\n" +
172
			"----------\n" +
173
			"6. ERROR in I.java (at line 8)\n" +
174
			"	public strictfp synchronized @Annot void foo5();\n" +
175
			"	                                         ^^^^^^\n" + 
176
			"Illegal modifier for the interface method foo5; only public, abstract, static, default and strictfp are permitted\n" +
167
			"----------\n");
177
			"----------\n");
168
	}
178
	}
169
179
Lines 184-190 Link Here
184
			"1. ERROR in I.java (at line 2)\n" + 
194
			"1. ERROR in I.java (at line 2)\n" + 
185
			"	native void foo1();\n" + 
195
			"	native void foo1();\n" + 
186
			"	            ^^^^^^\n" + 
196
			"	            ^^^^^^\n" + 
187
			"Illegal modifier for the interface method foo1; only public & abstract are permitted\n" + 
197
			"Illegal modifier for the interface method foo1; only public, abstract, static, default and strictfp are permitted\n" + 
188
			"----------\n" + 
198
			"----------\n" + 
189
			"2. ERROR in I.java (at line 3)\n" + 
199
			"2. ERROR in I.java (at line 3)\n" + 
190
			"	static void foo2();\n" + 
200
			"	static void foo2();\n" + 
Lines 194-215 Link Here
194
			"3. ERROR in I.java (at line 4)\n" + 
204
			"3. ERROR in I.java (at line 4)\n" + 
195
			"	native default void foo3() {}\n" + 
205
			"	native default void foo3() {}\n" + 
196
			"	                    ^^^^^^\n" + 
206
			"	                    ^^^^^^\n" + 
197
			"Illegal modifier for the interface method foo3; only public, abstract and strictfp are permitted\n" + 
207
			"Illegal modifier for the interface method foo3; only public, abstract, static, default and strictfp are permitted\n" + 
198
			"----------\n" + 
208
			"----------\n" + 
199
			"4. ERROR in I.java (at line 5)\n" + 
209
			"4. ERROR in I.java (at line 5)\n" + 
200
			"	default native void foo4() {}\n" + 
210
			"	default native void foo4() {}\n" + 
201
			"	                    ^^^^^^\n" + 
211
			"	                    ^^^^^^\n" + 
202
			"Illegal modifier for the interface method foo4; only public, abstract and strictfp are permitted\n" + 
212
			"Illegal modifier for the interface method foo4; only public, abstract, static, default and strictfp are permitted\n" + 
203
			"----------\n" + 
213
			"----------\n" + 
204
			"5. ERROR in I.java (at line 6)\n" + 
214
			"5. ERROR in I.java (at line 6)\n" + 
205
			"	static default void foo5() {}\n" + 
215
			"	static default void foo5() {}\n" + 
206
			"	                    ^^^^^^\n" + 
216
			"	                    ^^^^^^\n" + 
207
			"Illegal modifier for the interface method foo5; only public, abstract and strictfp are permitted\n" + 
217
			"Illegal combination of modifiers for the interface method foo5; only one of abstract, default, or static permitted\n" + 
208
			"----------\n" + 
218
			"----------\n" + 
209
			"6. ERROR in I.java (at line 7)\n" + 
219
			"6. ERROR in I.java (at line 7)\n" + 
210
			"	default static void foo6() {}\n" + 
220
			"	default static void foo6() {}\n" + 
211
			"	                    ^^^^^^\n" + 
221
			"	                    ^^^^^^\n" + 
212
			"Illegal modifier for the interface method foo6; only public, abstract and strictfp are permitted\n" + 
222
			"Illegal combination of modifiers for the interface method foo6; only one of abstract, default, or static permitted\n" + 
213
			"----------\n");
223
			"----------\n");
214
	}
224
	}
215
225
Lines 230-241 Link Here
230
			"1. ERROR in I.java (at line 4)\n" + 
240
			"1. ERROR in I.java (at line 4)\n" + 
231
			"	public abstract default void foo2() {}\n" + 
241
			"	public abstract default void foo2() {}\n" + 
232
			"	                             ^^^^^^\n" + 
242
			"	                             ^^^^^^\n" + 
233
			"Illegal modifier for the interface method foo2; only public, abstract and strictfp are permitted\n" + 
243
			"Illegal combination of modifiers for the interface method foo2; only one of abstract, default, or static permitted\n" + 
234
			"----------\n" + 
244
			"----------\n" + 
235
			"2. ERROR in I.java (at line 5)\n" + 
245
			"2. ERROR in I.java (at line 5)\n" + 
236
			"	default abstract void foo3() {}\n" + 
246
			"	default abstract void foo3() {}\n" + 
237
			"	                      ^^^^^^\n" + 
247
			"	                      ^^^^^^\n" + 
238
			"Illegal modifier for the interface method foo3; only public, abstract and strictfp are permitted\n" + 
248
			"Illegal combination of modifiers for the interface method foo3; only one of abstract, default, or static permitted\n" + 
239
			"----------\n" + 
249
			"----------\n" + 
240
			"3. ERROR in I.java (at line 6)\n" + 
250
			"3. ERROR in I.java (at line 6)\n" + 
241
			"	void foo4() { }\n" + 
251
			"	void foo4() { }\n" + 
Lines 245-251 Link Here
245
			"4. ERROR in I.java (at line 7)\n" + 
255
			"4. ERROR in I.java (at line 7)\n" + 
246
			"	abstract static default void foo5() {}\n" + 
256
			"	abstract static default void foo5() {}\n" + 
247
			"	                             ^^^^^^\n" + 
257
			"	                             ^^^^^^\n" + 
248
			"Illegal modifier for the interface method foo5; only public, abstract and strictfp are permitted\n" + 
258
			"Illegal combination of modifiers for the interface method foo5; only one of abstract, default, or static permitted\n" + 
249
			"----------\n");
259
			"----------\n");
250
	}
260
	}
251
261
Lines 1354-1370 Link Here
1354
				"2. ERROR in I.java (at line 4)\n" + 
1364
				"2. ERROR in I.java (at line 4)\n" + 
1355
				"	public static default void foo2 () {};\n" + 
1365
				"	public static default void foo2 () {};\n" + 
1356
				"	                           ^^^^^^^\n" + 
1366
				"	                           ^^^^^^^\n" + 
1357
				"Illegal modifier for the interface method foo2; only public, abstract and strictfp are permitted\n" + 
1367
				"Illegal combination of modifiers for the interface method foo2; only one of abstract, default, or static permitted\n" + 
1358
				"----------\n" + 
1368
				"----------\n" + 
1359
				"3. ERROR in I.java (at line 5)\n" + 
1369
				"3. ERROR in I.java (at line 5)\n" + 
1360
				"	abstract static void foo3();\n" + 
1370
				"	abstract static void foo3();\n" + 
1361
				"	                     ^^^^^^\n" + 
1371
				"	                     ^^^^^^\n" + 
1362
				"Illegal modifier for the interface method foo3; only public & abstract are permitted\n" + 
1372
				"Illegal combination of modifiers for the interface method foo3; only one of abstract, default, or static permitted\n" + 
1363
				"----------\n" + 
1373
				"----------\n" + 
1364
				"4. ERROR in I.java (at line 6)\n" + 
1374
				"4. ERROR in I.java (at line 6)\n" + 
1365
				"	abstract static void foo4() {}\n" + 
1375
				"	abstract static void foo4() {}\n" + 
1366
				"	                     ^^^^^^\n" + 
1376
				"	                     ^^^^^^\n" + 
1367
				"Illegal modifier for the interface method foo4; only public & abstract are permitted\n" + 
1377
				"Illegal combination of modifiers for the interface method foo4; only one of abstract, default, or static permitted\n" + 
1368
				"----------\n");
1378
				"----------\n");
1369
	}
1379
	}
1370
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=399780
1380
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=399780
Lines 2039-2042 Link Here
2039
            },
2049
            },
2040
            "In B.set(CharSequence)");
2050
            "In B.set(CharSequence)");
2041
    }
2051
    }
2052
    
2053
    // test for different error messages in modifiers.
2054
	public void test400977() {
2055
		runNegativeTest(
2056
		new String[] {
2057
			"I.java",
2058
			"public interface I {\n" +
2059
			"    default abstract void foo();\n" +
2060
			"    public abstract default strictfp final void bar();" +
2061
			"}\n"}, 
2062
			"----------\n" +
2063
			"1. ERROR in I.java (at line 2)\n" +
2064
			"	default abstract void foo();\n" +
2065
			"	                      ^^^^^\n" +
2066
			"Illegal combination of modifiers for the interface method foo; only one of abstract, default, or static permitted\n" +
2067
			"----------\n" +
2068
			"2. ERROR in I.java (at line 3)\n" +
2069
			"	public abstract default strictfp final void bar();}\n" +
2070
			"	                                            ^^^^^\n" +
2071
			"Illegal modifiers for the interface method bar; strictfp is not permitted for abstract interface method bar\n" +
2072
			"----------\n" +
2073
			"3. ERROR in I.java (at line 3)\n" +
2074
			"	public abstract default strictfp final void bar();}\n" +
2075
			"	                                            ^^^^^\n" +
2076
			"Illegal combination of modifiers for the interface method bar; only one of abstract, default, or static permitted\n" +
2077
			"----------\n" +
2078
			"4. ERROR in I.java (at line 3)\n" +
2079
			"	public abstract default strictfp final void bar();}\n" +
2080
			"	                                            ^^^^^\n" +
2081
			"Illegal modifier for the interface method bar; only public, abstract, static, default and strictfp are permitted\n" +
2082
			"----------\n");
2083
	}
2084
2042
}
2085
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/core/compiler/IProblem.java (-1 / +5 lines)
Lines 1693-1699 Link Here
1693
1693
1694
	// default methods:
1694
	// default methods:
1695
	/** @since 3.9 BETA_JAVA8 */
1695
	/** @since 3.9 BETA_JAVA8 */
1696
	int IllegalModifierForInterfaceDefaultMethod = MethodRelated + 1050;
1696
	int IllegalModifierForInterfaceMethod18 = MethodRelated + 1050;
1697
1697
1698
	/** @since 3.9 BETA_JAVA8 */
1698
	/** @since 3.9 BETA_JAVA8 */
1699
	int DefaultMethodOverridesObjectMethod = MethodRelated + 1051;
1699
	int DefaultMethodOverridesObjectMethod = MethodRelated + 1051;
Lines 1708-1713 Link Here
1708
	int SuperAccessCannotBypassDirectSuper = TypeRelated + 1054;
1708
	int SuperAccessCannotBypassDirectSuper = TypeRelated + 1054;
1709
	/** @since 3.9 BETA_JAVA8 */
1709
	/** @since 3.9 BETA_JAVA8 */
1710
	int SuperCallCannotBypassOverride = MethodRelated + 1055;
1710
	int SuperCallCannotBypassOverride = MethodRelated + 1055;
1711
	/** @since 3.9 BETA_JAVA8 */
1712
	int IllegalModifierCombinationForInterfaceMethod = MethodRelated + 1056;
1713
	/** @since 3.9 BETA_JAVA8 */
1714
	int IllegalAbstractStrictfpModifierCombinationForInterfaceMethod = MethodRelated + 1057;
1711
1715
1712
	/**
1716
	/**
1713
	 * External problems -- These are problems defined by other plugins
1717
	 * External problems -- These are problems defined by other plugins
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodScope.java (-3 / +15 lines)
Lines 179-188 Link Here
179
	if (declaringClass.isInterface()) {
179
	if (declaringClass.isInterface()) {
180
		int expectedModifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract;
180
		int expectedModifiers = ClassFileConstants.AccPublic | ClassFileConstants.AccAbstract;
181
		boolean isDefaultMethod = (modifiers & ExtraCompilerModifiers.AccDefaultMethod) != 0; // no need to check validity, is done by the parser
181
		boolean isDefaultMethod = (modifiers & ExtraCompilerModifiers.AccDefaultMethod) != 0; // no need to check validity, is done by the parser
182
		boolean reportIllegalModifierCombination = false;
183
		boolean isJDK18orGreater = false;
182
		if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_8 && !declaringClass.isAnnotationType()) {
184
		if (compilerOptions().sourceLevel >= ClassFileConstants.JDK1_8 && !declaringClass.isAnnotationType()) {
185
			expectedModifiers |= ClassFileConstants.AccStrictfp
186
					| ExtraCompilerModifiers.AccDefaultMethod | ClassFileConstants.AccStatic;
187
			isJDK18orGreater = true;
183
			if (!methodBinding.isAbstract()) {
188
			if (!methodBinding.isAbstract()) {
184
				expectedModifiers |= ClassFileConstants.AccStrictfp
189
				reportIllegalModifierCombination = isDefaultMethod && methodBinding.isStatic();
185
										| (isDefaultMethod ?  ExtraCompilerModifiers.AccDefaultMethod : ClassFileConstants.AccStatic);
190
			} else {
191
				reportIllegalModifierCombination = isDefaultMethod || methodBinding.isStatic();
192
				if (methodBinding.isStrictfp()) {
193
					problemReporter().illegalAbstractStrictfpModifierCombinationForInterfaceMethod((AbstractMethodDeclaration) this.referenceContext);
194
				}
195
			}
196
			if (reportIllegalModifierCombination) {
197
				problemReporter().illegalModifierCombinationForInterfaceMethod((AbstractMethodDeclaration) this.referenceContext);
186
			}
198
			}
187
			// Kludge - The AccDefaultMethod bit is outside the lower 16 bits and got removed earlier. Putting it back.
199
			// Kludge - The AccDefaultMethod bit is outside the lower 16 bits and got removed earlier. Putting it back.
188
			if (isDefaultMethod) {
200
			if (isDefaultMethod) {
Lines 193-199 Link Here
193
			if ((declaringClass.modifiers & ClassFileConstants.AccAnnotation) != 0)
205
			if ((declaringClass.modifiers & ClassFileConstants.AccAnnotation) != 0)
194
				problemReporter().illegalModifierForAnnotationMember((AbstractMethodDeclaration) this.referenceContext);
206
				problemReporter().illegalModifierForAnnotationMember((AbstractMethodDeclaration) this.referenceContext);
195
			else
207
			else
196
				problemReporter().illegalModifierForInterfaceMethod((AbstractMethodDeclaration) this.referenceContext, isDefaultMethod);
208
				problemReporter().illegalModifierForInterfaceMethod((AbstractMethodDeclaration) this.referenceContext, isJDK18orGreater);
197
		}
209
		}
198
		return;
210
		return;
199
	}
211
	}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-3 / +22 lines)
Lines 2442-2447 Link Here
2442
		methodDecl.sourceStart,
2442
		methodDecl.sourceStart,
2443
		methodDecl.sourceEnd);
2443
		methodDecl.sourceEnd);
2444
}
2444
}
2445
public void illegalAbstractStrictfpModifierCombinationForInterfaceMethod(AbstractMethodDeclaration methodDecl) {
2446
	String[] arguments = new String[] {new String(methodDecl.selector)};
2447
	this.handle(
2448
		IProblem.IllegalAbstractStrictfpModifierCombinationForInterfaceMethod,
2449
		arguments,
2450
		arguments,
2451
		methodDecl.sourceStart,
2452
		methodDecl.sourceEnd);
2453
}
2445
public void illegalAccessFromTypeVariable(TypeVariableBinding variable, ASTNode location) {
2454
public void illegalAccessFromTypeVariable(TypeVariableBinding variable, ASTNode location) {
2446
	if ((location.bits & ASTNode.InsideJavadoc)!= 0) {
2455
	if ((location.bits & ASTNode.InsideJavadoc)!= 0) {
2447
		javadocInvalidReference(location.sourceStart, location.sourceEnd);
2456
		javadocInvalidReference(location.sourceStart, location.sourceEnd);
Lines 2568-2573 Link Here
2568
		fieldDecl.sourceStart,
2577
		fieldDecl.sourceStart,
2569
		fieldDecl.sourceEnd);
2578
		fieldDecl.sourceEnd);
2570
}
2579
}
2580
public void illegalModifierCombinationForInterfaceMethod(AbstractMethodDeclaration methodDecl) {
2581
	String[] arguments = new String[] {new String(methodDecl.selector)};
2582
	this.handle(
2583
		IProblem.IllegalModifierCombinationForInterfaceMethod,
2584
		arguments,
2585
		arguments,
2586
		methodDecl.sourceStart,
2587
		methodDecl.sourceEnd);
2588
}
2589
2571
public void illegalModifierForAnnotationField(FieldDeclaration fieldDecl) {
2590
public void illegalModifierForAnnotationField(FieldDeclaration fieldDecl) {
2572
	String name = new String(fieldDecl.name);
2591
	String name = new String(fieldDecl.name);
2573
	this.handle(
2592
	this.handle(
Lines 2685-2696 Link Here
2685
		fieldDecl.sourceStart,
2704
		fieldDecl.sourceStart,
2686
		fieldDecl.sourceEnd);
2705
		fieldDecl.sourceEnd);
2687
}
2706
}
2688
public void illegalModifierForInterfaceMethod(AbstractMethodDeclaration methodDecl, boolean isDefaultMethod) {
2707
public void illegalModifierForInterfaceMethod(AbstractMethodDeclaration methodDecl, boolean isJDK18orGreater) {
2689
	// cannot include parameter types since they are not resolved yet
2708
	// cannot include parameter types since they are not resolved yet
2690
	// and the error message would be too long
2709
	// and the error message would be too long
2691
	this.handle(
2710
	this.handle(
2692
		isDefaultMethod 
2711
		isJDK18orGreater 
2693
			? IProblem.IllegalModifierForInterfaceDefaultMethod 
2712
			? IProblem.IllegalModifierForInterfaceMethod18 
2694
			: IProblem.IllegalModifierForInterfaceMethod,
2713
			: IProblem.IllegalModifierForInterfaceMethod,
2695
		new String[] {
2714
		new String[] {
2696
			new String(methodDecl.selector)
2715
			new String(methodDecl.selector)
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/messages.properties (-1 / +3 lines)
Lines 787-798 Link Here
787
787
788
# Default methods:
788
# Default methods:
789
# variant of 359: 
789
# variant of 359: 
790
1050 = Illegal modifier for the interface method {0}; only public, abstract and strictfp are permitted
790
1050 = Illegal modifier for the interface method {0}; only public, abstract, static, default and strictfp are permitted
791
1051 = A default method cannot override a method from java.lang.Object 
791
1051 = A default method cannot override a method from java.lang.Object 
792
1052 = The default method {0} inherited from {1} conflicts with another method inherited from {2}
792
1052 = The default method {0} inherited from {1} conflicts with another method inherited from {2}
793
1053 = Duplicate default methods named {0} with the parameters ({1}) and ({2}) are inherited from the types {3} and {4}
793
1053 = Duplicate default methods named {0} with the parameters ({1}) and ({2}) are inherited from the types {3} and {4}
794
1054 = Illegal reference to super type {0}, cannot bypass the more specific direct super type {1}
794
1054 = Illegal reference to super type {0}, cannot bypass the more specific direct super type {1}
795
1055 = Illegal reference to super method {0} from type {1}, cannot bypass the more specific override from type {2}
795
1055 = Illegal reference to super method {0} from type {1}, cannot bypass the more specific override from type {2}
796
1056 = Illegal combination of modifiers for the interface method {0}; only one of abstract, default, or static permitted
797
1057 = Illegal modifiers for the interface method {0}; strictfp is not permitted for abstract interface method {0}
796
798
797
### ELABORATIONS
799
### ELABORATIONS
798
## Access restrictions
800
## Access restrictions

Return to bug 400977