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

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullAnnotationTest.java (-1 / +37 lines)
Lines 52-58 Link Here
52
// Static initializer to specify tests subset using TESTS_* static variables
52
// Static initializer to specify tests subset using TESTS_* static variables
53
// All specified tests which do not belong to the class are skipped...
53
// All specified tests which do not belong to the class are skipped...
54
static {
54
static {
55
//		TESTS_NAMES = new String[] { "test_illegal_annotation_00" };
55
//		TESTS_NAMES = new String[] { "test_illegal_annotation_007" };
56
//		TESTS_NUMBERS = new int[] { 561 };
56
//		TESTS_NUMBERS = new int[] { 561 };
57
//		TESTS_RANGE = new int[] { 1, 2049 };
57
//		TESTS_RANGE = new int[] { 1, 2049 };
58
}
58
}
Lines 1812-1817 Link Here
1812
		"----------\n");
1812
		"----------\n");
1813
}
1813
}
1814
1814
1815
// a configured annotation type does not exist
1816
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=186342#c133
1817
public void test_illegal_annotation_007() {
1818
	Map customOptions = getCompilerOptions();
1819
	runNegativeTestWithLibs(
1820
		new String[] {
1821
			"p/Test.java",
1822
			"package p;\n" +
1823
			"import org.eclipse.jdt.annotation.*;\n" +
1824
			"interface TestInt{\n" +
1825
			"	@NonNull Object foo();\n" +
1826
			"}\n" +
1827
			"\n" +
1828
			"public class Test { \n" +
1829
			"	void bar() {" +
1830
			"		new TestInt() {\n" +
1831
			"        	@org public Object foo() {\n" +
1832
			"        	}\n" +
1833
			"		};\n" +
1834
			"	}\n" +
1835
			"}"
1836
		},
1837
		customOptions,
1838
		"----------\n" + 
1839
		"1. ERROR in p\\Test.java (at line 9)\n" + 
1840
		"	@org public Object foo() {\n" + 
1841
		"	 ^^^\n" + 
1842
		"org cannot be resolved to a type\n" + 
1843
		"----------\n" + 
1844
		"2. ERROR in p\\Test.java (at line 9)\n" + 
1845
		"	@org public Object foo() {\n" + 
1846
		"	            ^^^^^^\n" + 
1847
		"The return type is incompatible with the @NonNull return from TestInt.foo()\n" + 
1848
		"----------\n");
1849
}
1850
1815
public void test_default_nullness_002() {
1851
public void test_default_nullness_002() {
1816
	Map customOptions = getCompilerOptions();
1852
	Map customOptions = getCompilerOptions();
1817
//	customOptions.put(CompilerOptions.OPTION_ReportPotentialNullSpecViolation, JavaCore.ERROR);
1853
//	customOptions.put(CompilerOptions.OPTION_ReportPotentialNullSpecViolation, JavaCore.ERROR);
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-1 / +1 lines)
Lines 8128-8134 Link Here
8128
	Annotation[] annotations = methodDecl.annotations;
8128
	Annotation[] annotations = methodDecl.annotations;
8129
	if (annotations != null) {
8129
	if (annotations != null) {
8130
		for (int i=0; i<annotations.length; i++) {
8130
		for (int i=0; i<annotations.length; i++) {
8131
			if (annotations[i].resolvedType.id == TypeIds.T_ConfiguredAnnotationNullable) {
8131
			if (annotations[i].resolvedType != null && annotations[i].resolvedType.id == TypeIds.T_ConfiguredAnnotationNullable) {
8132
				sourceStart = annotations[i].sourceStart;
8132
				sourceStart = annotations[i].sourceStart;
8133
				break;
8133
				break;
8134
			}
8134
			}

Return to bug 186342