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

(-)compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java (-1 / +3 lines)
Lines 451-457 Link Here
451
				this.statements[i].resolve(this.scope);
451
				this.statements[i].resolve(this.scope);
452
			}
452
			}
453
		} else if ((this.bits & UndocumentedEmptyBlock) != 0) {
453
		} else if ((this.bits & UndocumentedEmptyBlock) != 0) {
454
			this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd+1);
454
			if (!this.isConstructor() || this.arguments != null) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=319626
455
				this.scope.problemReporter().undocumentedEmptyBlock(this.bodyStart-1, this.bodyEnd+1);
456
			}
455
		}
457
		}
456
	}
458
	}
457
459
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java (-16 / +6 lines)
Lines 14421-14443 Link Here
14421
		"	                                       ^^^^\n" +
14421
		"	                                       ^^^^\n" +
14422
		"Empty block should be documented\n" +
14422
		"Empty block should be documented\n" +
14423
		"----------\n" +
14423
		"----------\n" +
14424
		"2. ERROR in X.java (at line 9)\n" +
14424
		"2. ERROR in X.java (at line 11)\n" +
14425
		"	X(){}\n" +
14426
		"	   ^^\n" +
14427
		"Empty block should be documented\n" +
14428
		"----------\n" +
14429
		"3. ERROR in X.java (at line 11)\n" +
14430
		"	missingReturnType(){\n" +
14425
		"	missingReturnType(){\n" +
14431
		"	^^^^^^^^^^^^^^^^^^^\n" +
14426
		"	^^^^^^^^^^^^^^^^^^^\n" +
14432
		"Return type for the method is missing\n" +
14427
		"Return type for the method is missing\n" +
14433
		"----------\n" +
14428
		"----------\n" +
14434
		"4. ERROR in X.java (at line 11)\n" +
14429
		"3. ERROR in X.java (at line 11)\n" +
14435
		"	missingReturnType(){\n" +
14430
		"	missingReturnType(){\n" +
14436
		"	}\n" +
14431
		"	}\n" +
14437
		"	                   ^^^^\n" +
14432
		"	                   ^^^^\n" +
14438
		"Empty block should be documented\n" +
14433
		"Empty block should be documented\n" +
14439
		"----------\n" +
14434
		"----------\n" +
14440
		"5. ERROR in X.java (at line 13)\n" +
14435
		"4. ERROR in X.java (at line 13)\n" +
14441
		"	missingReturnType2(){ /*do nothing*/\n" +
14436
		"	missingReturnType2(){ /*do nothing*/\n" +
14442
		"	^^^^^^^^^^^^^^^^^^^^\n" +
14437
		"	^^^^^^^^^^^^^^^^^^^^\n" +
14443
		"Return type for the method is missing\n" +
14438
		"Return type for the method is missing\n" +
Lines 14485-14507 Link Here
14485
		"	^\n" +
14480
		"	^\n" +
14486
		"Syntax error on token \"Invalid Character\", delete this token\n" +
14481
		"Syntax error on token \"Invalid Character\", delete this token\n" +
14487
		"----------\n" +
14482
		"----------\n" +
14488
		"3. ERROR in X.java (at line 10)\n" +
14483
		"3. ERROR in X.java (at line 12)\n" +
14489
		"	X(){}\n" +
14490
		"	   ^^\n" +
14491
		"Empty block should be documented\n" +
14492
		"----------\n" +
14493
		"4. ERROR in X.java (at line 12)\n" +
14494
		"	missingReturnType(){\n" +
14484
		"	missingReturnType(){\n" +
14495
		"	^^^^^^^^^^^^^^^^^^^\n" +
14485
		"	^^^^^^^^^^^^^^^^^^^\n" +
14496
		"Return type for the method is missing\n" +
14486
		"Return type for the method is missing\n" +
14497
		"----------\n" +
14487
		"----------\n" +
14498
		"5. ERROR in X.java (at line 12)\n" +
14488
		"4. ERROR in X.java (at line 12)\n" +
14499
		"	missingReturnType(){\n" +
14489
		"	missingReturnType(){\n" +
14500
		"	}\n" +
14490
		"	}\n" +
14501
		"	                   ^^^^\n" +
14491
		"	                   ^^^^\n" +
14502
		"Empty block should be documented\n" +
14492
		"Empty block should be documented\n" +
14503
		"----------\n" +
14493
		"----------\n" +
14504
		"6. ERROR in X.java (at line 14)\n" +
14494
		"5. ERROR in X.java (at line 14)\n" +
14505
		"	missingReturnType2(){ /*do nothing*/\n" +
14495
		"	missingReturnType2(){ /*do nothing*/\n" +
14506
		"	^^^^^^^^^^^^^^^^^^^^\n" +
14496
		"	^^^^^^^^^^^^^^^^^^^^\n" +
14507
		"Return type for the method is missing\n" +
14497
		"Return type for the method is missing\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java (-6 / +1 lines)
Lines 688-699 Link Here
688
		"	                       ^^\n" +
688
		"	                       ^^\n" +
689
		"Empty block should be documented\n" +
689
		"Empty block should be documented\n" +
690
		"----------\n" +
690
		"----------\n" +
691
		"2. ERROR in X.java (at line 8)\n" +
691
		"2. ERROR in X.java (at line 9)\n" +
692
		"	A() {}\n" +
693
		"	    ^^\n" +
694
		"Empty block should be documented\n" +
695
		"----------\n" +
696
		"3. ERROR in X.java (at line 9)\n" +
697
		"	public void bar() {}\n" +
692
		"	public void bar() {}\n" +
698
		"	                  ^^\n" +
693
		"	                  ^^\n" +
699
		"Empty block should be documented\n" +
694
		"Empty block should be documented\n" +
(-)src/org/eclipse/jdt/core/tests/compiler/regression/NonFatalErrorTest.java (+52 lines)
Lines 206-209 Link Here
206
			// javac options
206
			// javac options
207
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
207
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
208
	}
208
	}
209
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319626
210
	public void test006() {
211
		Map customOptions = getCompilerOptions();
212
		customOptions.put(CompilerOptions.OPTION_FatalOptionalError, CompilerOptions.DISABLED);
213
		customOptions.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.ERROR);
214
		runNegativeTest(
215
			// test directory preparation
216
			true /* flush output directory */,
217
			new String[] { /* test files */
218
				"X.java",
219
				"public class X {\n" +
220
				"	{     }\n" +
221
				"	static {  }\n" +
222
				" 	X() { }\n" +
223
				" 	X(int a) {}\n" +
224
				" 	public void foo() {}\n" +
225
				"	public static void main(String argv[]) {\n" +
226
				"		System.out.println(\"SUCCESS\");\n" +
227
				"	}\n" +
228
				"}\n"
229
			},
230
			// compiler options
231
			null /* no class libraries */,
232
			customOptions /* custom options */,
233
			// compiler results
234
			"----------\n" + 
235
			"1. ERROR in X.java (at line 2)\n" + 
236
			"	{     }\n" + 
237
			"	^^^^^^^\n" + 
238
			"Empty block should be documented\n" + 
239
			"----------\n" + 
240
			"2. ERROR in X.java (at line 3)\n" + 
241
			"	static {  }\n" + 
242
			"	       ^^^^\n" + 
243
			"Empty block should be documented\n" + 
244
			"----------\n" + 
245
			"3. ERROR in X.java (at line 5)\n" + 
246
			"	X(int a) {}\n" + 
247
			"	         ^^\n" + 
248
			"Empty block should be documented\n" + 
249
			"----------\n" + 
250
			"4. ERROR in X.java (at line 6)\n" + 
251
			"	public void foo() {}\n" + 
252
			"	                  ^^\n" + 
253
			"Empty block should be documented\n" + 
254
			"----------\n",
255
			// runtime results
256
			"SUCCESS" /* expected output string */,
257
			null /* do not check error string */,
258
			// javac options
259
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
260
	}
209
}
261
}

Return to bug 319626