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

Collapse All | Expand All

(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java (-2 / +133 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 47-53 Link Here
47
	// Static initializer to specify tests subset using TESTS_* static variables
47
	// Static initializer to specify tests subset using TESTS_* static variables
48
	// All specified tests which do not belong to the class are skipped...
48
	// All specified tests which do not belong to the class are skipped...
49
	static {
49
	static {
50
//		TESTS_NAMES = new String[] { "test293" };
50
//		TESTS_NAMES = new String[] { "testBug365437" };
51
//		TESTS_NUMBERS = new int[] { 297 };
51
//		TESTS_NUMBERS = new int[] { 297 };
52
//		TESTS_RANGE = new int[] { 294, -1 };
52
//		TESTS_RANGE = new int[] { 294, -1 };
53
	}
53
	}
Lines 10148-10151 Link Here
10148
		"Bla cannot be resolved to a type\n" +
10148
		"Bla cannot be resolved to a type\n" +
10149
		"----------\n");
10149
		"----------\n");
10150
}
10150
}
10151
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10152
public void testBug365437a() {
10153
	Map customOptions = getCompilerOptions();
10154
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10155
	String exclusionAnnotations = 
10156
			"p1.PreDestroy," +
10157
			"p1.PostConstruct";
10158
	customOptions.put(CompilerOptions.OPTION_AnnotationsToExemptUnusedMethods, exclusionAnnotations);
10159
	String testFiles [] = new String[] {
10160
			"p/A.java",
10161
			"package p;\n" +
10162
			"import p1.*;\n" +
10163
			"public class A {\n" +
10164
			"	@p1.PreDestroy\n" +
10165
			"	private void foo1(){}\n" +
10166
			"	@PreDestroy\n" +
10167
			"	private void foo2(){}\n" +
10168
			"	@p1.PostConstruct\n" +
10169
			"	private void foo1a(){}\n" +
10170
			"	@PostConstruct\n" +
10171
			"	private void foo2a(){}\n" +
10172
			"	private void foo3(){}" +
10173
			"}\n",
10174
			"p1/PreDestroy.java",
10175
			"package p1;\n" +
10176
			"public @interface PreDestroy{}",
10177
			"p1/PostConstruct.java",
10178
			"package p1;\n" +
10179
			"public @interface PostConstruct{}"
10180
			};
10181
	String expectedErrorString = 
10182
			"----------\n" + 
10183
			"1. ERROR in p\\A.java (at line 12)\n" + 
10184
			"	private void foo3(){}}\n" + 
10185
			"	             ^^^^^^\n" + 
10186
			"The method foo3() from the type A is never used locally\n" + 
10187
			"----------\n";
10188
	runNegativeTest(
10189
			true,
10190
			testFiles,
10191
			null, 
10192
			customOptions,
10193
			expectedErrorString,
10194
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10195
}
10196
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10197
public void testBug365437b() {
10198
	Map customOptions = getCompilerOptions();
10199
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10200
	String exclusionAnnotations = 
10201
			"javax.annotation.PreDestroy," +
10202
			"javax.annotation.Resource";
10203
	customOptions.put(CompilerOptions.OPTION_AnnotationsToExemptUnusedMethods, exclusionAnnotations);
10204
	String testFiles [] = new String[] {
10205
			"A.java",
10206
			"import javax.annotation.*;\n" +
10207
			"public class A {\n" +
10208
			"	@javax.annotation.PreDestroy\n" +
10209
			"	private void foo1(){}\n" +
10210
			"	@PreDestroy\n" +
10211
			"	private void foo2(){}\n" +
10212
			"	@javax.annotation.Resource\n" +
10213
			"	private void foo1a(){}\n" +
10214
			"	@Resource\n" +
10215
			"	private void foo2a(){}\n" +
10216
			"	@javax.annotation.PostConstruct\n" +
10217
			"	private void foo3(){}\n" +
10218
			"	@javax.annotation.PostConstruct\n" +
10219
			"	@Resource\n" +
10220
			"	private void foo3a(){}" +
10221
			"}\n"
10222
			};
10223
	String expectedErrorString = 
10224
			"----------\n" + 
10225
			"1. ERROR in A.java (at line 12)\n" + 
10226
			"	private void foo3(){}\n" + 
10227
			"	             ^^^^^^\n" + 
10228
			"The method foo3() from the type A is never used locally\n" + 
10229
			"----------\n";
10230
	runNegativeTest(
10231
			true,
10232
			testFiles,
10233
			null, 
10234
			customOptions,
10235
			expectedErrorString,
10236
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10237
}
10238
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10239
// test defaults
10240
public void testBug365437c() {
10241
	Map customOptions = getCompilerOptions();
10242
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10243
	String testFiles [] = new String[] {
10244
			"A.java",
10245
			"import javax.annotation.*;\n" +
10246
			"public class A {\n" +
10247
			"	@javax.annotation.PreDestroy\n" +
10248
			"	private void foo1(){}\n" +
10249
			"	@PreDestroy\n" +
10250
			"	private void foo2(){}\n" +
10251
			"	@javax.annotation.Resource\n" +
10252
			"	private void foo1a(){}\n" +
10253
			"	@Resource\n" +
10254
			"	private void foo2a(){}\n" +
10255
			"	@javax.annotation.PostConstruct\n" +
10256
			"	private void foo3(){}\n" +
10257
			"	@javax.annotation.PostConstruct\n" +
10258
			"	@Resource\n" +
10259
			"	private void foo3a(){}" +
10260
			"}\n"
10261
			};
10262
	String expectedErrorString = 
10263
			"----------\n" + 
10264
			"1. ERROR in A.java (at line 8)\n" + 
10265
			"	private void foo1a(){}\n" + 
10266
			"	             ^^^^^^^\n" + 
10267
			"The method foo1a() from the type A is never used locally\n" + 
10268
			"----------\n" + 
10269
			"2. ERROR in A.java (at line 10)\n" + 
10270
			"	private void foo2a(){}\n" + 
10271
			"	             ^^^^^^^\n" + 
10272
			"The method foo2a() from the type A is never used locally\n" + 
10273
			"----------\n";
10274
	runNegativeTest(
10275
			true,
10276
			testFiles,
10277
			null, 
10278
			customOptions,
10279
			expectedErrorString,
10280
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10281
}
10151
}
10282
}
(-)a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-19 / +60 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 52-58 Link Here
52
	private static final Main MAIN = new Main(null/*outWriter*/, null/*errWriter*/, false/*systemExit*/, null/*options*/, null/*progress*/);
52
	private static final Main MAIN = new Main(null/*outWriter*/, null/*errWriter*/, false/*systemExit*/, null/*options*/, null/*progress*/);
53
53
54
	static {
54
	static {
55
//		TESTS_NAMES = new String[] { "test295_warn_options" };
55
//		TESTS_NAMES = new String[] { "test311_warn_options" };
56
//		TESTS_NUMBERS = new int[] { 306 };
56
//		TESTS_NUMBERS = new int[] { 306 };
57
//		TESTS_RANGE = new int[] { 298, -1 };
57
//		TESTS_RANGE = new int[] { 298, -1 };
58
	}
58
	}
Lines 1668-1674 Link Here
1668
        "      allDeprecation       deprecation including inside deprecated code\n" + 
1668
        "      allDeprecation       deprecation including inside deprecated code\n" + 
1669
        "      allJavadoc           invalid or missing javadoc\n" + 
1669
        "      allJavadoc           invalid or missing javadoc\n" + 
1670
        "      allOver-ann          all missing @Override annotations\n" + 
1670
        "      allOver-ann          all missing @Override annotations\n" + 
1671
        "      all-static-method    all method can be declared as static warnings\n" +
1671
        "      all-static-method    all method can be declared as static warnings\n" + 
1672
        "      assertIdentifier   + ''assert'' used as identifier\n" + 
1672
        "      assertIdentifier   + ''assert'' used as identifier\n" + 
1673
        "      boxing               autoboxing conversion\n" + 
1673
        "      boxing               autoboxing conversion\n" + 
1674
        "      charConcat         + char[] in String concat\n" + 
1674
        "      charConcat         + char[] in String concat\n" + 
Lines 1722-1728 Link Here
1722
        "      syntheticAccess      synthetic access for innerclass\n" + 
1722
        "      syntheticAccess      synthetic access for innerclass\n" + 
1723
        "      tasks(<tags separated by |>) tasks identified by tags inside comments\n" + 
1723
        "      tasks(<tags separated by |>) tasks identified by tags inside comments\n" + 
1724
        "      typeHiding         + type parameter hiding another type\n" + 
1724
        "      typeHiding         + type parameter hiding another type\n" + 
1725
        "      unavoidableGenericProblems + ignore unavoidable type safety problems\n" +
1725
        "      unavoidableGenericProblems + ignore unavoidable type safety problems\n" + 
1726
        "                                   due to raw APIs\n" + 
1726
        "                                   due to raw APIs\n" + 
1727
        "      unchecked          + unchecked type operation\n" + 
1727
        "      unchecked          + unchecked type operation\n" + 
1728
        "      unnecessaryElse      unnecessary else clause\n" + 
1728
        "      unnecessaryElse      unnecessary else clause\n" + 
Lines 1736-1741 Link Here
1736
        "      unusedLabel        + unused label\n" + 
1736
        "      unusedLabel        + unused label\n" + 
1737
        "      unusedLocal        + unread local variable\n" + 
1737
        "      unusedLocal        + unread local variable\n" + 
1738
        "      unusedPrivate      + unused private member declaration\n" + 
1738
        "      unusedPrivate      + unused private member declaration\n" + 
1739
        "      unusedPrivateExempt(<names separated by |>) annotations mark method used\n" + 
1739
        "      unusedThrown         unused declared thrown exception\n" + 
1740
        "      unusedThrown         unused declared thrown exception\n" + 
1740
        "      unusedTypeArgs     + unused type arguments for method and constructor\n" + 
1741
        "      unusedTypeArgs     + unused type arguments for method and constructor\n" + 
1741
        "      uselessTypeCheck     unnecessary cast/instanceof operation\n" + 
1742
        "      uselessTypeCheck     unnecessary cast/instanceof operation\n" + 
Lines 1800-1810 Link Here
1800
			"		<argument value=\"---OUTPUT_DIR_PLACEHOLDER---\"/>\n" + 
1801
			"		<argument value=\"---OUTPUT_DIR_PLACEHOLDER---\"/>\n" + 
1801
			"	</command_line>\n" + 
1802
			"	</command_line>\n" + 
1802
			"	<options>\n" + 
1803
			"	<options>\n" + 
1803
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnull\" value=\"org.eclipse.jdt.annotation.NonNull\"/>\n" +
1804
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnull\" value=\"org.eclipse.jdt.annotation.NonNull\"/>\n" + 
1804
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnullbydefault\" value=\"org.eclipse.jdt.annotation.NonNullByDefault\"/>\n" +
1805
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnullbydefault\" value=\"org.eclipse.jdt.annotation.NonNullByDefault\"/>\n" + 
1805
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnullisdefault\" value=\"disabled\"/>\n" +
1806
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nonnullisdefault\" value=\"disabled\"/>\n" + 
1806
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nullable\" value=\"org.eclipse.jdt.annotation.Nullable\"/>\n" +
1807
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nullable\" value=\"org.eclipse.jdt.annotation.Nullable\"/>\n" + 
1807
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nullanalysis\" value=\"disabled\"/>\n" +
1808
			"		<option key=\"org.eclipse.jdt.core.compiler.annotation.nullanalysis\" value=\"disabled\"/>\n" + 
1808
			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode\" value=\"disabled\"/>\n" + 
1809
			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode\" value=\"disabled\"/>\n" + 
1809
			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.targetPlatform\" value=\"1.5\"/>\n" + 
1810
			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.targetPlatform\" value=\"1.5\"/>\n" + 
1810
			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.unusedLocal\" value=\"optimize out\"/>\n" + 
1811
			"		<option key=\"org.eclipse.jdt.core.compiler.codegen.unusedLocal\" value=\"optimize out\"/>\n" + 
Lines 1814-1820 Link Here
1814
			"		<option key=\"org.eclipse.jdt.core.compiler.debug.sourceFile\" value=\"generate\"/>\n" + 
1815
			"		<option key=\"org.eclipse.jdt.core.compiler.debug.sourceFile\" value=\"generate\"/>\n" + 
1815
			"		<option key=\"org.eclipse.jdt.core.compiler.doc.comment.support\" value=\"disabled\"/>\n" + 
1816
			"		<option key=\"org.eclipse.jdt.core.compiler.doc.comment.support\" value=\"disabled\"/>\n" + 
1816
			"		<option key=\"org.eclipse.jdt.core.compiler.generateClassFiles\" value=\"enabled\"/>\n" + 
1817
			"		<option key=\"org.eclipse.jdt.core.compiler.generateClassFiles\" value=\"enabled\"/>\n" + 
1817
			"		<option key=\"org.eclipse.jdt.core.compiler.maxProblemPerUnit\" value=\"100\"/>\n" +
1818
			"		<option key=\"org.eclipse.jdt.core.compiler.maxProblemPerUnit\" value=\"100\"/>\n" + 
1818
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + 
1819
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.annotationSuperInterface\" value=\"warning\"/>\n" + 
1819
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + 
1820
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"warning\"/>\n" + 
1820
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" + 
1821
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.autoboxing\" value=\"ignore\"/>\n" + 
Lines 1863-1880 Link Here
1863
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.noEffectAssignment\" value=\"warning\"/>\n" + 
1864
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.noEffectAssignment\" value=\"warning\"/>\n" + 
1864
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion\" value=\"warning\"/>\n" + 
1865
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion\" value=\"warning\"/>\n" + 
1865
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral\" value=\"ignore\"/>\n" + 
1866
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral\" value=\"ignore\"/>\n" + 
1866
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullReference\" value=\"warning\"/>\n" +
1867
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullReference\" value=\"warning\"/>\n" + 
1867
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo\" value=\"warning\"/>\n" +
1868
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo\" value=\"warning\"/>\n" + 
1868
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullSpecViolation\" value=\"error\"/>\n" +
1869
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.nullSpecViolation\" value=\"error\"/>\n" + 
1869
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation\" value=\"ignore\"/>\n" + 
1870
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingMethodWithoutSuperInvocation\" value=\"ignore\"/>\n" + 
1870
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" + 
1871
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod\" value=\"warning\"/>\n" + 
1871
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + 
1872
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.parameterAssignment\" value=\"ignore\"/>\n" + 
1872
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + 
1873
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment\" value=\"ignore\"/>\n" + 
1873
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + 
1874
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullReference\" value=\"ignore\"/>\n" + 
1874
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullSpecViolation\" value=\"error\"/>\n" +
1875
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentialNullSpecViolation\" value=\"error\"/>\n" + 
1875
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable\" value=\"ignore\"/>\n" +
1876
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable\" value=\"ignore\"/>\n" + 
1876
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" +
1877
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.rawTypeReference\" value=\"warning\"/>\n" + 
1877
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation\" value=\"warning\"/>\n" +
1878
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation\" value=\"warning\"/>\n" + 
1878
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + 
1879
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantNullCheck\" value=\"ignore\"/>\n" + 
1879
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments\" value=\"ignore\"/>\n" + 
1880
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments\" value=\"ignore\"/>\n" + 
1880
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + 
1881
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.redundantSuperinterface\" value=\"ignore\"/>\n" + 
Lines 1887-1893 Link Here
1887
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation\" value=\"ignore\"/>\n" + 
1888
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation\" value=\"ignore\"/>\n" + 
1888
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.tasks\" value=\"warning\"/>\n" + 
1889
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.tasks\" value=\"warning\"/>\n" + 
1889
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.typeParameterHiding\" value=\"warning\"/>\n" + 
1890
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.typeParameterHiding\" value=\"warning\"/>\n" + 
1890
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems\" value=\"enabled\"/>\n" +
1891
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems\" value=\"enabled\"/>\n" + 
1891
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation\" value=\"warning\"/>\n" + 
1892
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation\" value=\"warning\"/>\n" + 
1892
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unclosedCloseable\" value=\"ignore\"/>\n" + 
1893
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unclosedCloseable\" value=\"ignore\"/>\n" + 
1893
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock\" value=\"ignore\"/>\n" + 
1894
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock\" value=\"ignore\"/>\n" + 
Lines 1909-1921 Link Here
1909
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete\" value=\"disabled\"/>\n" + 
1910
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete\" value=\"disabled\"/>\n" + 
1910
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedPrivateMember\" value=\"warning\"/>\n" + 
1911
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedPrivateMember\" value=\"warning\"/>\n" + 
1911
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedTypeArgumentsForMethodInvocation\" value=\"warning\"/>\n" + 
1912
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedTypeArgumentsForMethodInvocation\" value=\"warning\"/>\n" + 
1913
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedWarningExcludedTypes\" value=\"\"/>\n" + 
1912
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedWarningToken\" value=\"warning\"/>\n" + 
1914
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.unusedWarningToken\" value=\"warning\"/>\n" + 
1913
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast\" value=\"warning\"/>\n" + 
1915
			"		<option key=\"org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast\" value=\"warning\"/>\n" + 
1914
			"		<option key=\"org.eclipse.jdt.core.compiler.processAnnotations\" value=\"disabled\"/>\n" + 
1916
			"		<option key=\"org.eclipse.jdt.core.compiler.processAnnotations\" value=\"disabled\"/>\n" + 
1915
			"		<option key=\"org.eclipse.jdt.core.compiler.source\" value=\"1.5\"/>\n" + 
1917
			"		<option key=\"org.eclipse.jdt.core.compiler.source\" value=\"1.5\"/>\n" + 
1916
			"		<option key=\"org.eclipse.jdt.core.compiler.taskCaseSensitive\" value=\"enabled\"/>\n" + 
1918
			"		<option key=\"org.eclipse.jdt.core.compiler.taskCaseSensitive\" value=\"enabled\"/>\n" + 
1917
			"		<option key=\"org.eclipse.jdt.core.compiler.taskPriorities\" value=\"\"/>\n" + 
1919
			"		<option key=\"org.eclipse.jdt.core.compiler.taskPriorities\" value=\"\"/>\n" + 
1918
			"		<option key=\"org.eclipse.jdt.core.compiler.taskTags\" value=\"\"/>\n" + 
1920
			"		<option key=\"org.eclipse.jdt.core.compiler.taskTags\" value=\"\"/>\n" +  
1919
			"	</options>\n" + 
1921
			"	</options>\n" + 
1920
			"	<classpaths>NORMALIZED SECTION</classpaths>\n" + 
1922
			"	<classpaths>NORMALIZED SECTION</classpaths>\n" + 
1921
			"	<sources>\n" + 
1923
			"	<sources>\n" + 
Lines 12352-12355 Link Here
12352
		"1 problem (1 warning)", 
12354
		"1 problem (1 warning)", 
12353
		true);
12355
		true);
12354
}
12356
}
12357
12358
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
12359
// test batch compiler option to specify annotations to exclude private methods
12360
// from unused warning
12361
public void test311_warn_options() {
12362
	String testFiles [] = new String[] {
12363
			"A.java",
12364
			"import javax.annotation.*;\n" +
12365
			"public class A {\n" +
12366
			"	@javax.annotation.PreDestroy\n" +
12367
			"	private void foo1(){}\n" +
12368
			"	@PreDestroy\n" +
12369
			"	private void foo2(){}\n" +
12370
			"	@javax.annotation.Resource\n" +
12371
			"	private void foo1a(){}\n" +
12372
			"	@Resource\n" +
12373
			"	private void foo2a(){}\n" +
12374
			"	@javax.annotation.PostConstruct\n" +
12375
			"	private void foo3(){}\n" +
12376
			"	@javax.annotation.PostConstruct\n" +
12377
			"	@Resource\n" +
12378
			"	private void foo3a(){}" +
12379
			"}\n"
12380
			};
12381
	runConformTest(
12382
			testFiles,
12383
			"\"" + OUTPUT_DIR +  File.separator + "A.java\""
12384
			+ " -sourcepath \"" + OUTPUT_DIR + "\""
12385
			+ " -warn:unusedPrivateExempt(javax.annotation.PreDestroy|javax.annotation.Resource) -1.5 -proc:none -d \"" + OUTPUT_DIR + "\"",
12386
			"",
12387
			"----------\n" + 
12388
			"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/A.java (at line 12)\n" + 
12389
			"	private void foo3(){}\n" + 
12390
			"	             ^^^^^^\n" + 
12391
			"The method foo3() from the type A is never used locally\n" + 
12392
			"----------\n" + 
12393
			"1 problem (1 warning)", 
12394
			true);
12395
}
12355
}
12396
}
(-)a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-1 / +18 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 3535-3540 Link Here
3535
			} else if (token.equals("unusedPrivate")) { //$NON-NLS-1$
3535
			} else if (token.equals("unusedPrivate")) { //$NON-NLS-1$
3536
				setSeverity(CompilerOptions.OPTION_ReportUnusedPrivateMember, severity, isEnabling);
3536
				setSeverity(CompilerOptions.OPTION_ReportUnusedPrivateMember, severity, isEnabling);
3537
				return;
3537
				return;
3538
			} else if (token.startsWith("unusedPrivateExempt")) { //$NON-NLS-1$
3539
				String unusedWarningExcludingAnnotations = Util.EMPTY_STRING;
3540
				int start = token.indexOf('(');
3541
				int end = token.indexOf(')');
3542
				if (start >= 0 && end >= 0 && start < end){
3543
					unusedWarningExcludingAnnotations = token.substring(start+1, end).trim();
3544
					unusedWarningExcludingAnnotations = unusedWarningExcludingAnnotations.replace('|',',');
3545
				}
3546
				if (unusedWarningExcludingAnnotations.length() == 0){
3547
					throw new IllegalArgumentException(this.bind("configure.invalidUnusedPrivateExempt", token)); //$NON-NLS-1$
3548
				}
3549
				this.options.put(
3550
					CompilerOptions.OPTION_AnnotationsToExemptUnusedMethods,
3551
					isEnabling ? unusedWarningExcludingAnnotations : Util.EMPTY_STRING);
3552
				
3553
				setSeverity(CompilerOptions.OPTION_ReportUnusedPrivateMember, severity, isEnabling);
3554
				return;
3538
			} else if (token.equals("unusedLabel")) { //$NON-NLS-1$
3555
			} else if (token.equals("unusedLabel")) { //$NON-NLS-1$
3539
				setSeverity(CompilerOptions.OPTION_ReportUnusedLabel, severity, isEnabling);
3556
				setSeverity(CompilerOptions.OPTION_ReportUnusedLabel, severity, isEnabling);
3540
				return;
3557
				return;
(-)a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (+2 lines)
Lines 82-87 Link Here
82
configure.unsupportedEncoding = unsupported encoding format: {0}
82
configure.unsupportedEncoding = unsupported encoding format: {0}
83
configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0}
83
configure.duplicateDefaultEncoding = duplicate default encoding format specification: {0}
84
configure.invalidTaskTag ={0} is an invalid task tag
84
configure.invalidTaskTag ={0} is an invalid task tag
85
configure.invalidUnusedPrivateExempt = fully qualified annotation type names expected
85
configure.incorrectExtDirsEntry = incorrect ext dir entry; {0} must be a directory
86
configure.incorrectExtDirsEntry = incorrect ext dir entry; {0} must be a directory
86
configure.incorrectEndorsedDirsEntry = incorrect endorsed dir entry; {0} must be a directory
87
configure.incorrectEndorsedDirsEntry = incorrect endorsed dir entry; {0} must be a directory
87
configure.duplicateEndorsedDirs = duplicate endorseddirs specification: {0}
88
configure.duplicateEndorsedDirs = duplicate endorseddirs specification: {0}
Lines 340-345 Link Here
340
\      unusedLabel        + unused label\n\
341
\      unusedLabel        + unused label\n\
341
\      unusedLocal        + unread local variable\n\
342
\      unusedLocal        + unread local variable\n\
342
\      unusedPrivate      + unused private member declaration\n\
343
\      unusedPrivate      + unused private member declaration\n\
344
\      unusedPrivateExempt(<names separated by |>) annotations mark method used\n\
343
\      unusedThrown         unused declared thrown exception\n\
345
\      unusedThrown         unused declared thrown exception\n\
344
\      unusedTypeArgs     + unused type arguments for method and constructor\n\
346
\      unusedTypeArgs     + unused type arguments for method and constructor\n\
345
\      uselessTypeCheck     unnecessary cast/instanceof operation\n\
347
\      uselessTypeCheck     unnecessary cast/instanceof operation\n\
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java (-6 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 168-178 Link Here
168
			case TypeIds.T_JavaLangInvokeMethodHandlePolymorphicSignature :
168
			case TypeIds.T_JavaLangInvokeMethodHandlePolymorphicSignature :
169
				tagBits |= TagBits.AnnotationPolymorphicSignature;
169
				tagBits |= TagBits.AnnotationPolymorphicSignature;
170
				break;
170
				break;
171
			case TypeIds.T_JavaxAnnotationPostConstruct :
171
			case TypeIds.T_UnusedWarningExclusionAnnotation :
172
				tagBits |= TagBits.AnnotationPostConstruct;
172
				tagBits |= TagBits.AnnotationToExcludeUnusedWarning;
173
				break;
174
			case TypeIds.T_JavaxAnnotationPreDestroy :
175
				tagBits |= TagBits.AnnotationPreDestroy;
176
				break;
173
				break;
177
			case TypeIds.T_ConfiguredAnnotationNullable :
174
			case TypeIds.T_ConfiguredAnnotationNullable :
178
				tagBits |= TagBits.AnnotationNullable;
175
				tagBits |= TagBits.AnnotationNullable;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java (-8 lines)
Lines 303-312 Link Here
303
					currentOffset += 2;
303
					currentOffset += 2;
304
					return readTargetValue(currentOffset);
304
					return readTargetValue(currentOffset);
305
				}
305
				}
306
				if (CharOperation.equals(typeName, ConstantPool.JAVAX_ANNOTATION_PREDESTROY)) {
307
					this.standardAnnotationTagBits |= TagBits.AnnotationPreDestroy;
308
					return currentOffset;
309
				}
310
				break;
306
				break;
311
			case 32:
307
			case 32:
312
				if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_RETENTION)) {
308
				if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_RETENTION)) {
Lines 315-324 Link Here
315
				}
311
				}
316
				if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_INHERITED)) {
312
				if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_INHERITED)) {
317
					this.standardAnnotationTagBits |= TagBits.AnnotationInherited;
313
					this.standardAnnotationTagBits |= TagBits.AnnotationInherited;
318
					return currentOffset;
319
				}
320
				if (CharOperation.equals(typeName, ConstantPool.JAVAX_ANNOTATION_POSTCONSTRUCT)) {
321
					this.standardAnnotationTagBits |= TagBits.AnnotationPostConstruct;
322
					return currentOffset;
314
					return currentOffset;
323
				}
315
				}
324
				break;
316
				break;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java (-3 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 248-255 Link Here
248
	public static final char[] JAVA_LANG_SAFEVARARGS = "Ljava/lang/SafeVarargs;".toCharArray(); //$NON-NLS-1$
248
	public static final char[] JAVA_LANG_SAFEVARARGS = "Ljava/lang/SafeVarargs;".toCharArray(); //$NON-NLS-1$
249
	// java 7 java.lang.invoke.MethodHandle.invokeExact(..)/invokeGeneric(..)
249
	// java 7 java.lang.invoke.MethodHandle.invokeExact(..)/invokeGeneric(..)
250
	public static final char[] JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE = "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".toCharArray(); //$NON-NLS-1$
250
	public static final char[] JAVA_LANG_INVOKE_METHODHANDLE_POLYMORPHICSIGNATURE = "Ljava/lang/invoke/MethodHandle$PolymorphicSignature;".toCharArray(); //$NON-NLS-1$
251
	public static final char[] JAVAX_ANNOTATION_POSTCONSTRUCT = "Ljavax/annotation/PostConstruct;".toCharArray(); //$NON-NLS-1$
252
	public static final char[] JAVAX_ANNOTATION_PREDESTROY = "Ljavax/annotation/PreDestroy;".toCharArray(); //$NON-NLS-1$
253
251
254
	public static final char[] HashCode = "hashCode".toCharArray(); //$NON-NLS-1$
252
	public static final char[] HashCode = "hashCode".toCharArray(); //$NON-NLS-1$
255
	public static final char[] HashCodeSignature = "()I".toCharArray(); //$NON-NLS-1$; 
253
	public static final char[] HashCodeSignature = "()I".toCharArray(); //$NON-NLS-1$; 
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (-2 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 157-162 Link Here
157
	static final char[][] DEFAULT_NONNULL_ANNOTATION_NAME = CharOperation.splitOn('.', "org.eclipse.jdt.annotation.NonNull".toCharArray()); //$NON-NLS-1$
157
	static final char[][] DEFAULT_NONNULL_ANNOTATION_NAME = CharOperation.splitOn('.', "org.eclipse.jdt.annotation.NonNull".toCharArray()); //$NON-NLS-1$
158
	static final char[][] DEFAULT_NONNULLBYDEFAULT_ANNOTATION_NAME = CharOperation.splitOn('.', "org.eclipse.jdt.annotation.NonNullByDefault".toCharArray()); //$NON-NLS-1$
158
	static final char[][] DEFAULT_NONNULLBYDEFAULT_ANNOTATION_NAME = CharOperation.splitOn('.', "org.eclipse.jdt.annotation.NonNullByDefault".toCharArray()); //$NON-NLS-1$
159
	public static final String OPTION_NonNullIsDefault = "org.eclipse.jdt.core.compiler.annotation.nonnullisdefault";  //$NON-NLS-1$
159
	public static final String OPTION_NonNullIsDefault = "org.eclipse.jdt.core.compiler.annotation.nonnullisdefault";  //$NON-NLS-1$
160
	
161
	public static final String OPTION_AnnotationsToExemptUnusedMethods = "org.eclipse.jdt.core.compiler.problem.annotationsToExemptUnusedPrivateMethods"; //$NON-NLS-1$
160
	/**
162
	/**
161
	 * Possible values for configurable options
163
	 * Possible values for configurable options
162
	 */
164
	 */
Lines 388-393 Link Here
388
	public boolean includeNullInfoFromAsserts;
390
	public boolean includeNullInfoFromAsserts;
389
	/** Controls whether forced generic type problems get reported  */
391
	/** Controls whether forced generic type problems get reported  */
390
	public boolean reportUnavoidableGenericTypeProblems;
392
	public boolean reportUnavoidableGenericTypeProblems;
393
	/** Private methods tagged with these annotation types will not be reported as unused */
394
	public char[][] annotationsToExcludeUnusedMethods; 
391
395
392
	// === Support for Null Annotations: ===
396
	// === Support for Null Annotations: ===
393
	/** Master switch for null analysis based on annotations: */
397
	/** Master switch for null analysis based on annotations: */
Lines 780-786 Link Here
780
			OPTION_ReportNullSpecViolation,
784
			OPTION_ReportNullSpecViolation,
781
			OPTION_ReportPotentialNullSpecViolation,
785
			OPTION_ReportPotentialNullSpecViolation,
782
			OPTION_ReportNullSpecInsufficientInfo,
786
			OPTION_ReportNullSpecInsufficientInfo,
783
			OPTION_ReportRedundantNullAnnotation
787
			OPTION_ReportRedundantNullAnnotation,
788
			OPTION_AnnotationsToExemptUnusedMethods
784
		};
789
		};
785
		return result;
790
		return result;
786
	}
791
	}
Lines 1072-1077 Link Here
1072
		optionsMap.put(OPTION_NullableAnnotationName, String.valueOf(CharOperation.concatWith(this.nullableAnnotationName, '.')));
1077
		optionsMap.put(OPTION_NullableAnnotationName, String.valueOf(CharOperation.concatWith(this.nullableAnnotationName, '.')));
1073
		optionsMap.put(OPTION_NonNullAnnotationName, String.valueOf(CharOperation.concatWith(this.nonNullAnnotationName, '.')));
1078
		optionsMap.put(OPTION_NonNullAnnotationName, String.valueOf(CharOperation.concatWith(this.nonNullAnnotationName, '.')));
1074
		optionsMap.put(OPTION_NonNullByDefaultAnnotationName, String.valueOf(CharOperation.concatWith(this.nonNullByDefaultAnnotationName, '.')));
1079
		optionsMap.put(OPTION_NonNullByDefaultAnnotationName, String.valueOf(CharOperation.concatWith(this.nonNullByDefaultAnnotationName, '.')));
1080
		optionsMap.put(OPTION_AnnotationsToExemptUnusedMethods, this.annotationsToExcludeUnusedMethods == null ? Util.EMPTY_STRING : new String(CharOperation.concatWith(this.annotationsToExcludeUnusedMethods,',')));
1075
		if (this.defaultNonNullness == TagBits.AnnotationNonNull)
1081
		if (this.defaultNonNullness == TagBits.AnnotationNonNull)
1076
			optionsMap.put(OPTION_NonNullIsDefault, CompilerOptions.ENABLED);
1082
			optionsMap.put(OPTION_NonNullIsDefault, CompilerOptions.ENABLED);
1077
		else
1083
		else
Lines 1232-1237 Link Here
1232
		this.nonNullAnnotationName = DEFAULT_NONNULL_ANNOTATION_NAME;
1238
		this.nonNullAnnotationName = DEFAULT_NONNULL_ANNOTATION_NAME;
1233
		this.nonNullByDefaultAnnotationName = DEFAULT_NONNULLBYDEFAULT_ANNOTATION_NAME;
1239
		this.nonNullByDefaultAnnotationName = DEFAULT_NONNULLBYDEFAULT_ANNOTATION_NAME;
1234
		this.defaultNonNullness = 0;
1240
		this.defaultNonNullness = 0;
1241
		
1242
		this.annotationsToExcludeUnusedMethods = new char[][] { 
1243
				"javax.annotation.PreDestroy".toCharArray(), //$NON-NLS-1$
1244
				"javax.annotation.PostConstruct".toCharArray() //$NON-NLS-1$
1245
		};
1235
	}
1246
	}
1236
1247
1237
	public void set(Map optionsMap) {
1248
	public void set(Map optionsMap) {
Lines 1548-1553 Link Here
1548
					this.defaultNonNullness = 0;
1559
					this.defaultNonNullness = 0;
1549
			}
1560
			}
1550
		}
1561
		}
1562
		
1563
		if ((optionValue = optionsMap.get(OPTION_AnnotationsToExemptUnusedMethods)) != null) {
1564
			if (optionValue instanceof String) {
1565
				String stringValue = (String) optionValue;
1566
				if (stringValue.length() == 0) {
1567
					this.annotationsToExcludeUnusedMethods = null;
1568
				} else {
1569
					this.annotationsToExcludeUnusedMethods = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
1570
				}
1571
			}
1572
		}
1551
1573
1552
		// Javadoc options
1574
		// Javadoc options
1553
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
1575
		if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java (-9 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 54-63 Link Here
54
		count++;
54
		count++;
55
	if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
55
	if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
56
		count++;
56
		count++;
57
	if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0)
58
		count++;
59
	if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0)
60
		count++;
61
	// count must be different from 0
57
	// count must be different from 0
62
58
63
	int index = recordedAnnotations.length;
59
	int index = recordedAnnotations.length;
Lines 81-90 Link Here
81
		result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env);
77
		result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env);
82
	if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
78
	if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
83
		result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS, env);
79
		result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS, env);
84
	if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0)
85
		result[index++] = buildMarkerAnnotation(TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT, env);
86
	if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0)
87
		result[index++] = buildMarkerAnnotation(TypeConstants.JAVAX_ANNOTATION_PREDESTROY, env);
88
	return result;
80
	return result;
89
}
81
}
90
82
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/BinaryTypeBinding.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 147-153 Link Here
147
 */
147
 */
148
public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, LookupEnvironment environment) {
148
public BinaryTypeBinding(PackageBinding packageBinding, IBinaryType binaryType, LookupEnvironment environment) {
149
	this.compoundName = CharOperation.splitOn('/', binaryType.getName());
149
	this.compoundName = CharOperation.splitOn('/', binaryType.getName());
150
	computeId();
150
	computeId(environment);
151
151
152
	this.tagBits |= TagBits.IsBinaryBinding;
152
	this.tagBits |= TagBits.IsBinaryBinding;
153
	this.environment = environment;
153
	this.environment = environment;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/LookupEnvironment.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 1080-1085 Link Here
1080
	return packageBinding.getType0(compoundName[compoundName.length - 1]);
1080
	return packageBinding.getType0(compoundName[compoundName.length - 1]);
1081
}
1081
}
1082
1082
1083
public char[][] getUnusedWarningExclusionAnnotations() {
1084
	return this.globalOptions.annotationsToExcludeUnusedMethods;
1085
}
1086
1083
public char[][] getNullableAnnotationName() {
1087
public char[][] getNullableAnnotationName() {
1084
	return this.globalOptions.nullableAnnotationName;
1088
	return this.globalOptions.nullableAnnotationName;
1085
}
1089
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MissingTypeBinding.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 26-32 Link Here
26
 */
26
 */
27
public MissingTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) {
27
public MissingTypeBinding(PackageBinding packageBinding, char[][] compoundName, LookupEnvironment environment) {
28
	this.compoundName = compoundName;
28
	this.compoundName = compoundName;
29
	computeId();
29
	computeId(environment);
30
	this.tagBits |= TagBits.IsBinaryBinding | TagBits.HierarchyHasProblems | TagBits.HasMissingType;
30
	this.tagBits |= TagBits.IsBinaryBinding | TagBits.HierarchyHasProblems | TagBits.HasMissingType;
31
	this.environment = environment;
31
	this.environment = environment;
32
	this.fPackage = packageBinding;
32
	this.fPackage = packageBinding;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java (-18 / +15 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 17-24 Link Here
17
import java.util.Comparator;
17
import java.util.Comparator;
18
18
19
import org.eclipse.jdt.core.compiler.CharOperation;
19
import org.eclipse.jdt.core.compiler.CharOperation;
20
import org.eclipse.jdt.core.compiler.IProblem;
20
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
21
import org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
21
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
22
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
23
import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
22
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
24
import org.eclipse.jdt.internal.compiler.util.SimpleLookupTable;
23
25
24
/*
26
/*
Lines 375-407 Link Here
375
	return result;
377
	return result;
376
}
378
}
377
379
378
public void computeId() {
380
public void computeId(LookupEnvironment env) {
381
	char[][] unusedWarningExclusionAnnotations = env.getUnusedWarningExclusionAnnotations();
382
	if (env.problemReporter.computeSeverity(IProblem.UnusedPrivateMethod) != ProblemSeverities.Ignore
383
			&& unusedWarningExclusionAnnotations != null) {
384
		int len = unusedWarningExclusionAnnotations.length;
385
		for (int i = 0; i < len; i++) {
386
			if (CharOperation.equals(CharOperation.concatWith(this.compoundName,'.'), unusedWarningExclusionAnnotations[i]))
387
				this.id = TypeIds.T_UnusedWarningExclusionAnnotation;
388
		}
389
	}
379
	// try to avoid multiple checks against a package/type name
390
	// try to avoid multiple checks against a package/type name
380
	switch (this.compoundName.length) {
391
	switch (this.compoundName.length) {
381
392
382
		case 3 :
393
		case 3 :
383
			if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])
394
			if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0]))
384
					&& !CharOperation.equals(TypeConstants.JAVAX, this.compoundName[0]))
385
				return;
395
				return;
386
			
396
			
387
			char[] packageName = this.compoundName[1];
397
			char[] packageName = this.compoundName[1];
388
			if (packageName.length == 0) return; // just to be safe
398
			if (packageName.length == 0) return; // just to be safe
389
			char[] typeName = this.compoundName[2];
399
			char[] typeName = this.compoundName[2];
390
			if (typeName.length == 0) return; // just to be safe
400
			if (typeName.length == 0) return; // just to be safe
391
			// remaining types MUST be in java.*.*
401
			
392
			if (CharOperation.equals(TypeConstants.JAVAX, this.compoundName[0])) {
393
				if (CharOperation.equals(TypeConstants.ANNOTATION, this.compoundName[1])) {
394
					switch (typeName[0]) {
395
						case 'P' :
396
							if (CharOperation.equals(typeName, TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT[2]))
397
								this.id = TypeIds.T_JavaxAnnotationPostConstruct;
398
							if (CharOperation.equals(typeName, TypeConstants.JAVAX_ANNOTATION_PREDESTROY[2]))
399
								this.id = TypeIds.T_JavaxAnnotationPreDestroy;
400
							return;
401
					}
402
				}
403
				return;
404
			}
405
			if (!CharOperation.equals(TypeConstants.LANG, this.compoundName[1])) {
402
			if (!CharOperation.equals(TypeConstants.LANG, this.compoundName[1])) {
406
				switch (packageName[0]) {
403
				switch (packageName[0]) {
407
					case 'i' :
404
					case 'i' :
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/SourceTypeBinding.java (-2 / +2 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 72-78 Link Here
72
	this.fields = Binding.UNINITIALIZED_FIELDS;
72
	this.fields = Binding.UNINITIALIZED_FIELDS;
73
	this.methods = Binding.UNINITIALIZED_METHODS;
73
	this.methods = Binding.UNINITIALIZED_METHODS;
74
74
75
	computeId();
75
	computeId(scope.environment());
76
}
76
}
77
77
78
private void addDefaultAbstractMethods() {
78
private void addDefaultAbstractMethods() {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.java (-6 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 130-138 Link Here
130
	/** @since 3.7 - java 7 MethodHandle.invokeExact(..)/invokeGeneric(..)*/
130
	/** @since 3.7 - java 7 MethodHandle.invokeExact(..)/invokeGeneric(..)*/
131
	long AnnotationPolymorphicSignature = ASTNode.Bit53L;
131
	long AnnotationPolymorphicSignature = ASTNode.Bit53L;
132
	/** @since 3.8 */
132
	/** @since 3.8 */
133
	long AnnotationPreDestroy = ASTNode.Bit54L;
133
	long AnnotationToExcludeUnusedWarning = ASTNode.Bit54L;
134
	/** @since 3.8 */
135
	long AnnotationPostConstruct = ASTNode.Bit55L;
136
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
134
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
137
	long AnnotationNullable = ASTNode.Bit56L;
135
	long AnnotationNullable = ASTNode.Bit56L;
138
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
136
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
Lines 152-159 Link Here
152
				| AnnotationSuppressWarnings
150
				| AnnotationSuppressWarnings
153
				| AnnotationSafeVarargs
151
				| AnnotationSafeVarargs
154
				| AnnotationPolymorphicSignature
152
				| AnnotationPolymorphicSignature
155
				| AnnotationPostConstruct
153
				| AnnotationToExcludeUnusedWarning
156
				| AnnotationPreDestroy
157
				| AnnotationNullable
154
				| AnnotationNullable
158
				| AnnotationNonNull
155
				| AnnotationNonNull
159
				| AnnotationNonNullByDefault
156
				| AnnotationNonNullByDefault
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeConstants.java (-13 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 177-194 Link Here
177
	char[] SYNTHETIC_ACCESS_METHOD_PREFIX =  "access$".toCharArray(); //$NON-NLS-1$
177
	char[] SYNTHETIC_ACCESS_METHOD_PREFIX =  "access$".toCharArray(); //$NON-NLS-1$
178
	char[] SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX =  " enum constant initialization$".toCharArray(); //$NON-NLS-1$
178
	char[] SYNTHETIC_ENUM_CONSTANT_INITIALIZATION_METHOD_PREFIX =  " enum constant initialization$".toCharArray(); //$NON-NLS-1$
179
	char[] SYNTHETIC_STATIC_FACTORY =  "<factory>".toCharArray(); //$NON-NLS-1$
179
	char[] SYNTHETIC_STATIC_FACTORY =  "<factory>".toCharArray(); //$NON-NLS-1$
180
	char[][] JAVAX_ANNOTATION_POSTCONSTRUCT =
181
			new char[][] {
182
				JAVAX,
183
				ANNOTATION,
184
				"PostConstruct".toCharArray() //$NON-NLS-1$
185
			};
186
	char[][] JAVAX_ANNOTATION_PREDESTROY =
187
			new char[][] {
188
				JAVAX,
189
				ANNOTATION,
190
				"PreDestroy".toCharArray() //$NON-NLS-1$
191
			};
192
180
193
	// synthetic package-info name
181
	// synthetic package-info name
194
	public static final char[] PACKAGE_INFO_NAME = "package-info".toCharArray(); //$NON-NLS-1$
182
	public static final char[] PACKAGE_INFO_NAME = "package-info".toCharArray(); //$NON-NLS-1$
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TypeIds.java (-7 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 102-115 Link Here
102
	final int T_JavaLangAutoCloseable = 62;
102
	final int T_JavaLangAutoCloseable = 62;
103
103
104
	// new in 3.8
104
	// new in 3.8
105
	final int T_JavaxAnnotationPostConstruct = 63;
105
	final int T_UnusedWarningExclusionAnnotation = 63;
106
107
	final int T_JavaxAnnotationPreDestroy = 64;
108
	
106
	
109
	// new in 3.8 for null annotations:
107
	// new in 3.8 for null annotations:
110
	final int T_ConfiguredAnnotationNullable = 65;
108
	final int T_ConfiguredAnnotationNullable = 64;
111
	final int T_ConfiguredAnnotationNonNull = 66;
109
	final int T_ConfiguredAnnotationNonNull = 65;
112
	final int T_ConfiguredAnnotationNonNullByDefault = 67;
110
	final int T_ConfiguredAnnotationNonNullByDefault = 66;
113
111
114
	final int NoId = Integer.MAX_VALUE;
112
	final int NoId = Integer.MAX_VALUE;
115
113
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-3 / +4 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 7691-7698 Link Here
7691
			&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
7691
			&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
7692
		return;
7692
		return;
7693
	}
7693
	}
7694
	if ((method.tagBits & (TagBits.AnnotationPostConstruct | TagBits.AnnotationPreDestroy)) != 0) {
7694
	
7695
		// PostConstruct and PreDestroy method are ignored
7695
	if ((method.tagBits & TagBits.AnnotationToExcludeUnusedWarning) != 0) {
7696
		// method tagged with annotation that excludes the method from unused warning
7696
		return;
7697
		return;
7697
	}
7698
	}
7698
	this.handle(
7699
	this.handle(
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java (-1 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 624-629 Link Here
624
	 */
624
	 */
625
	public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
625
	public static final String COMPILER_PB_UNUSED_PRIVATE_MEMBER = PLUGIN_ID + ".compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
626
	/**
626
	/**
627
	 * Compiler option ID: Annotations that exempt a private method from being reported as unused.
628
	 * <p>When the {@link #COMPILER_PB_UNUSED_PRIVATE_MEMBER} is enabled, the compiler will not report
629
	 *    private methods that are declared with these annotations, even if the method is otherwise unused.
630
	 * <dl>
631
	 * <dt>Option id:</dt><dd><code>"org.eclipse.jdt.core.compiler.problem.annotationsToExemptUnusedPrivateMethods"</code></dd>
632
	 * <dt>Possible values:</dt><dd>Fully qualified annotation type names</dd>
633
	 * <dt>Default:</dt><dd><code>javax.annotation.PreDestroy, javax.annotation.PostConstruct</code></dd>
634
	 * </dl>
635
	 * @since 3.8
636
	 * @category CompilerOptionID
637
	 */
638
	public static final String COMPILER_ANNOTATIONS_TO_EXEMPT_UNUSED_PRIVATE_METHOD = PLUGIN_ID + ".compiler.problem.annotationsToExemptUnusedPrivateMethods"; //$NON-NLS-1$
639
	/**
627
	 * Compiler option ID: Reporting Local Variable Declaration Hiding another Variable.
640
	 * Compiler option ID: Reporting Local Variable Declaration Hiding another Variable.
628
	 * <p>When enabled, the compiler will issue an error or a warning whenever a local variable
641
	 * <p>When enabled, the compiler will issue an error or a warning whenever a local variable
629
	 *    declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
642
	 *    declaration is hiding some field or local variable (either locally, inherited or defined in enclosing type).
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java (-7 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 86-97 Link Here
86
	}
86
	}
87
	if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) {
87
	if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) {
88
		annotations.add(getAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS));
88
		annotations.add(getAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS));
89
	}
90
	if ((tagBits & TagBits.AnnotationPostConstruct) != 0) {
91
		annotations.add(getAnnotation(TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT));
92
	}
93
	if ((tagBits & TagBits.AnnotationPreDestroy) != 0) {
94
		annotations.add(getAnnotation(TypeConstants.JAVAX_ANNOTATION_PREDESTROY));
95
	}
89
	}
96
	// note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries
90
	// note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries
97
	return (IAnnotation[]) annotations.toArray(new IAnnotation[annotations.size()]);
91
	return (IAnnotation[]) annotations.toArray(new IAnnotation[annotations.size()]);
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java (-7 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 107-118 Link Here
107
	}
107
	}
108
	if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) {
108
	if ((tagBits & TagBits.AnnotationSafeVarargs) != 0) {
109
		generateStandardAnnotation(javaElement, TypeConstants.JAVA_LANG_SAFEVARARGS, Annotation.NO_MEMBER_VALUE_PAIRS, newElements);
109
		generateStandardAnnotation(javaElement, TypeConstants.JAVA_LANG_SAFEVARARGS, Annotation.NO_MEMBER_VALUE_PAIRS, newElements);
110
	}
111
	if ((tagBits & TagBits.AnnotationPostConstruct) != 0) {
112
		generateStandardAnnotation(javaElement, TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT, Annotation.NO_MEMBER_VALUE_PAIRS, newElements);
113
	}
114
	if ((tagBits & TagBits.AnnotationPreDestroy) != 0) {
115
		generateStandardAnnotation(javaElement, TypeConstants.JAVAX_ANNOTATION_PREDESTROY, Annotation.NO_MEMBER_VALUE_PAIRS, newElements);
116
	}
110
	}
117
	// note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries
111
	// note that JAVA_LANG_SUPPRESSWARNINGS and JAVA_LANG_OVERRIDE cannot appear in binaries
118
}
112
}
(-)a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java (-9 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 83-96 Link Here
83
		if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
83
		if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
84
			char[][] compoundName =
84
			char[][] compoundName =
85
					TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
85
					TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
86
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
87
		}
88
		if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) {
89
			char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT;
90
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
91
		}
92
		if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) {
93
			char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_PREDESTROY;
94
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
86
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
95
		}
87
		}
96
	}
88
	}
(-)a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java (-13 / +1 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 142-159 Link Here
142
	}
142
	}
143
	if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
143
	if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
144
		char[][] compoundName = TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
144
		char[][] compoundName = TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
145
		if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) {
146
			return true;
147
		}
148
	}
149
	if ((annotationTagBits & TagBits.AnnotationPostConstruct) != 0) {
150
		char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_POSTCONSTRUCT;
151
		if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) {
152
			return true;
153
		}
154
	}
155
	if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0) {
156
		char[][] compoundName = TypeConstants.JAVAX_ANNOTATION_PREDESTROY;
157
		if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) {
145
		if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) {
158
			return true;
146
			return true;
159
		}
147
		}

Return to bug 365437