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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/parser/ParserTest.java (+79 lines)
Lines 623-626 Link Here
623
		options // custom options
623
		options // custom options
624
	);
624
	);
625
}
625
}
626
/*
627
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=160337
628
 */
629
public void test025() {
630
	Map options = getCompilerOptions();
631
	options.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.ERROR);
632
	this.runNegativeTest(
633
		new String[] {
634
			"X.java",
635
			"public class X {\n" + 
636
			"        static class Y {\n" + 
637
			"                public void foo(int i) {}\n" + 
638
			"        }\n" + 
639
			"        static Y FakeInvocationSite = new Y(){\n" + 
640
			"                public void foo(int i) {}\n" + 
641
			"        };\n" + 
642
			"}"
643
		},
644
		"----------\n" + 
645
		"1. ERROR in X.java (at line 3)\n" + 
646
		"	public void foo(int i) {}\n" + 
647
		"	                       ^^\n" + 
648
		"Empty block should be documented\n" + 
649
		"----------\n" + 
650
		"2. ERROR in X.java (at line 6)\n" + 
651
		"	public void foo(int i) {}\n" + 
652
		"	                       ^^\n" + 
653
		"Empty block should be documented\n" + 
654
		"----------\n",
655
		null, // custom classpath
656
		true, // flush previous output dir content
657
		options // custom options
658
	);
659
}
660
/*
661
 * https://bugs.eclipse.org/bugs/show_bug.cgi?id=160337
662
 */
663
public void test026() {
664
	Map options = getCompilerOptions();
665
	options.put(CompilerOptions.OPTION_ReportUndocumentedEmptyBlock, CompilerOptions.ERROR);
666
	this.runNegativeTest(
667
		new String[] {
668
			"X.java",
669
			"public class X {\n" + 
670
			"        static class Y {\n" + 
671
			"                public void foo(int i) {}\n" + 
672
			"        }\n" + 
673
			"        static Y FakeInvocationSite = new Y(){\n" + 
674
			"                public void foo(int i) {\n" +
675
			"					class A {\n" +
676
			"						A() {}\n" +
677
			"						public void bar() {}\n" +
678
			"					}\n" +
679
			"					new A().bar();\n" +
680
			"				 }\n" + 
681
			"        };\n" + 
682
			"}"
683
		},
684
		"----------\n" + 
685
		"1. ERROR in X.java (at line 3)\n" + 
686
		"	public void foo(int i) {}\n" + 
687
		"	                       ^^\n" + 
688
		"Empty block should be documented\n" + 
689
		"----------\n" + 
690
		"2. ERROR in X.java (at line 8)\n" + 
691
		"	A() {}\n" + 
692
		"	    ^^\n" + 
693
		"Empty block should be documented\n" + 
694
		"----------\n" + 
695
		"3. ERROR in X.java (at line 9)\n" + 
696
		"	public void bar() {}\n" + 
697
		"	                  ^^\n" + 
698
		"Empty block should be documented\n" + 
699
		"----------\n",
700
		null, // custom classpath
701
		true, // flush previous output dir content
702
		options // custom options
703
	);
704
}
626
}
705
}

Return to bug 160337