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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java (+31 lines)
Lines 70-75 Link Here
70
		reportMissingJavadocComments = null;
70
		reportMissingJavadocComments = null;
71
	}
71
	}
72
72
73
	// https://bugs.eclipse.org/bugs/show_bug.cgi?id=261323.
74
	// Test to make sure that the use of a static import as an annotation value counts as a use
75
	// (and consequently that there is no unused static import warning)
76
	public void test261323() {
77
		Map customOptions = getCompilerOptions();
78
		
79
		customOptions.put(CompilerOptions.OPTION_ReportUnusedImport, CompilerOptions.ERROR);
80
		customOptions.put(CompilerOptions.OPTION_SuppressWarnings, CompilerOptions.ENABLED);
81
		customOptions.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR);
82
83
		runNegativeTest(
84
			true,
85
			new String[] {
86
					"com/SomeTest.java",
87
					"package com;\n" + 
88
					"import static com.SomeTest.UNCHECKED;\n" + 
89
					"@SuppressWarnings(UNCHECKED)\n" + 
90
					"public class SomeTest {\n" + 
91
					"    public static final String UNCHECKED = \"unchecked\";\n" + 
92
					"}\n"
93
			}, 
94
			null, customOptions,
95
			"----------\n" +
96
			"1. ERROR in com\\SomeTest.java (at line 3)\n" +
97
			"	@SuppressWarnings(UNCHECKED)\n" +
98
			"	                  ^^^^^^^^^\n" +
99
			"Unnecessary @SuppressWarnings(\"unchecked\")\n" +
100
			"----------\n",
101
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
102
	}
103
73
	public void test001() {
104
	public void test001() {
74
		this.runConformTest(
105
		this.runConformTest(
75
			new String[] {
106
			new String[] {

Return to bug 261323