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 / +371 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 testFiles [] = new String[] {
10156
			"p/A.java",
10157
			"package p;\n" +
10158
			"import p1.*;\n" +
10159
			"public class A {\n" +
10160
			"	@p1.PreDestroy\n" +
10161
			"	private void foo1(){}\n" +
10162
			"	@PreDestroy\n" +
10163
			"	private void foo2(){}\n" +
10164
			"	@SuppressWarnings(\"null\")\n" +
10165
			"	@PostConstruct\n" +
10166
			"	private void foo1a(){}\n" +
10167
			"	@PostConstruct\n" +
10168
			"	private void foo2a(){}\n" +
10169
			"	@Deprecated" +
10170
			"	private void foo3(){}" +
10171
			"}\n",
10172
			"p1/PreDestroy.java",
10173
			"package p1;\n" +
10174
			"public @interface PreDestroy{}",
10175
			"p1/PostConstruct.java",
10176
			"package p1;\n" +
10177
			"public @interface PostConstruct{}"
10178
			};
10179
	String expectedErrorString = 
10180
			"----------\n" + 
10181
			"1. WARNING in p\\A.java (at line 8)\n" + 
10182
			"	@SuppressWarnings(\"null\")\n" + 
10183
			"	                  ^^^^^^\n" + 
10184
			"Unnecessary @SuppressWarnings(\"null\")\n" + 
10185
			"----------\n" + 
10186
			"2. ERROR in p\\A.java (at line 13)\n" + 
10187
			"	@Deprecated	private void foo3(){}}\n" + 
10188
			"	           	             ^^^^^^\n" + 
10189
			"The method foo3() from the type A is never used locally\n" + 
10190
			"----------\n";
10191
	runNegativeTest(
10192
			true,
10193
			testFiles,
10194
			null, 
10195
			customOptions,
10196
			expectedErrorString,
10197
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10198
}
10199
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10200
public void testBug365437b() {
10201
	Map customOptions = getCompilerOptions();
10202
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10203
	customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
10204
	customOptions.put(CompilerOptions.OPTION_NonNullAnnotationName, "p.NonNull");
10205
	String testFiles [] = new String[] {
10206
			"A.java",
10207
			"import javax.annotation.*;\n" +
10208
			"public class A {\n" +
10209
			"	@javax.annotation.PreDestroy\n" +
10210
			"	private void foo1(){}\n" +
10211
			"	@PreDestroy\n" +
10212
			"	private void foo2(){}\n" +
10213
			"	@javax.annotation.Resource\n" +
10214
			"	private void foo1a(){}\n" +
10215
			"	@Resource\n" +
10216
			"	@p.NonNull\n" +
10217
			"	private Object foo2a(){ return new Object();}\n" +
10218
			"	@javax.annotation.PostConstruct\n" +
10219
			"	@Deprecated\n" +
10220
			"	private void foo3(){}\n" +
10221
			"	@p.NonNull\n" +
10222
			"	private Object foo3a(){ return new Object();}\n" +
10223
			"}\n",
10224
			"p/NonNull.java",
10225
			"package p;\n" +
10226
			"import static java.lang.annotation.ElementType.*;\n" +
10227
			"import java.lang.annotation.*;\n" +
10228
			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE})\n" +
10229
			"public @interface NonNull {\n" +
10230
			"}"
10231
			};
10232
	String expectedErrorString = 
10233
			"----------\n" + 
10234
			"1. ERROR in A.java (at line 16)\n" + 
10235
			"	private Object foo3a(){ return new Object();}\n" + 
10236
			"	               ^^^^^^^\n" + 
10237
			"The method foo3a() from the type A is never used locally\n" + 
10238
			"----------\n";
10239
	runNegativeTest(
10240
			true,
10241
			testFiles,
10242
			null, 
10243
			customOptions,
10244
			expectedErrorString,
10245
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10246
}
10247
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10248
// @SafeVarargs
10249
public void testBug365437c() {
10250
	if (this.complianceLevel < ClassFileConstants.JDK1_7) return;
10251
	Map customOptions = getCompilerOptions();
10252
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10253
	String testFiles [] = new String[] {
10254
			"p/A.java",
10255
			"package p;\n" +
10256
			"import p1.*;\n" +
10257
			"public class A {\n" +
10258
			"	@p1.PreDestroy\n" +
10259
			"	private void foo1(){}\n" +
10260
			"	@PreDestroy\n" +
10261
			"	private void foo2(){}\n" +
10262
			"	@SuppressWarnings(\"null\")\n" +
10263
			"	@PostConstruct\n" +
10264
			"	private void foo1a(){}\n" +
10265
			"	@PostConstruct\n" +
10266
			"	private void foo2a(){}\n" +
10267
			"	@SafeVarargs" +
10268
			"	private final void foo3(Object... o){}" +
10269
			"}\n",
10270
			"p1/PreDestroy.java",
10271
			"package p1;\n" +
10272
			"public @interface PreDestroy{}",
10273
			"p1/PostConstruct.java",
10274
			"package p1;\n" +
10275
			"public @interface PostConstruct{}"
10276
			};
10277
	String expectedErrorString = 
10278
			"----------\n" + 
10279
			"1. WARNING in p\\A.java (at line 8)\n" + 
10280
			"	@SuppressWarnings(\"null\")\n" + 
10281
			"	                  ^^^^^^\n" + 
10282
			"Unnecessary @SuppressWarnings(\"null\")\n" + 
10283
			"----------\n" + 
10284
			"2. ERROR in p\\A.java (at line 13)\n" + 
10285
			"	@SafeVarargs	private final void foo3(Object... o){}}\n" + 
10286
			"	            	                   ^^^^^^^^^^^^^^^^^\n" + 
10287
			"The method foo3(Object...) from the type A is never used locally\n" + 
10288
			"----------\n";
10289
	runNegativeTest(
10290
			true,
10291
			testFiles,
10292
			null, 
10293
			customOptions,
10294
			expectedErrorString,
10295
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10296
}
10297
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10298
// unused constructor
10299
public void testBug365437d() {
10300
	Map customOptions = getCompilerOptions();
10301
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10302
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10303
	customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
10304
	customOptions.put(CompilerOptions.OPTION_NonNullAnnotationName, "p.NonNull");
10305
	this.runNegativeTest(
10306
		true,
10307
		new String[] {
10308
			"Example.java",
10309
			"class Example {\n" +
10310
			"  @p.Annot\n" +
10311
			"  private Example() {\n" +
10312
			"  }\n" +
10313
			"  public Example(int i) {\n" +
10314
			"  }\n" +
10315
			"}\n" +
10316
			"class E1 {\n" +
10317
			"	 @Deprecated\n" +
10318
			"    private E1() {}\n" +
10319
			"    public E1(long l) {}\n" +
10320
			"}\n" +
10321
			"class E2 {\n" +
10322
			"	 @SuppressWarnings(\"null\")\n" +
10323
			"    private E2() {}\n" +
10324
			"    public E2(long l) {}\n" +
10325
			"}\n" +
10326
			"class E3 {\n" +
10327
			"	 @p.NonNull\n" +
10328
			"    private E3() {}\n" +
10329
			"    public E3(long l) {}\n" +
10330
			"}\n" +
10331
			"class E4 {\n" +
10332
			"	 @Deprecated\n" +
10333
			"	 @p.Annot\n" +
10334
			"    private E4() {}\n" +
10335
			"    public E4(long l) {}\n" +
10336
			"}\n",
10337
			"p/NonNull.java",
10338
			"package p;\n" +
10339
			"import static java.lang.annotation.ElementType.*;\n" +
10340
			"import java.lang.annotation.*;\n" +
10341
			"@Target({TYPE, METHOD,PARAMETER,CONSTRUCTOR})\n" +
10342
			"public @interface NonNull {\n" +
10343
			"}",
10344
			"p/Annot.java",
10345
			"package p;\n" +
10346
			"import static java.lang.annotation.ElementType.*;\n" +
10347
			"import java.lang.annotation.*;\n" +
10348
			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE, CONSTRUCTOR})\n" +
10349
			"public @interface Annot {\n" +
10350
			"}"
10351
		},
10352
		null, customOptions,
10353
		"----------\n" + 
10354
		"1. ERROR in Example.java (at line 10)\n" + 
10355
		"	private E1() {}\n" + 
10356
		"	        ^^^^\n" + 
10357
		"The constructor E1() is never used locally\n" + 
10358
		"----------\n" + 
10359
		"2. WARNING in Example.java (at line 14)\n" + 
10360
		"	@SuppressWarnings(\"null\")\n" + 
10361
		"	                  ^^^^^^\n" + 
10362
		"Unnecessary @SuppressWarnings(\"null\")\n" + 
10363
		"----------\n" + 
10364
		"3. ERROR in Example.java (at line 15)\n" + 
10365
		"	private E2() {}\n" + 
10366
		"	        ^^^^\n" + 
10367
		"The constructor E2() is never used locally\n" + 
10368
		"----------\n" + 
10369
		"4. ERROR in Example.java (at line 20)\n" + 
10370
		"	private E3() {}\n" + 
10371
		"	        ^^^^\n" + 
10372
		"The constructor E3() is never used locally\n" + 
10373
		"----------\n",
10374
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10375
}
10376
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10377
// unused field
10378
public void testBug365437e() {
10379
	Map customOptions = getCompilerOptions();
10380
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10381
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10382
	customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
10383
	customOptions.put(CompilerOptions.OPTION_NonNullAnnotationName, "p.NonNull");
10384
	this.runNegativeTest(
10385
		true,
10386
		new String[] {
10387
			"Example.java",
10388
			"class Example {\n" +
10389
			"  @p.Annot\n" +
10390
			"  private int Ex;\n" +
10391
			"}\n" +
10392
			"class E1 {\n" +
10393
			"	 @Deprecated\n" +
10394
			"    private int E1;\n" +
10395
			"}\n" +
10396
			"class E2 {\n" +
10397
			"	 @SuppressWarnings(\"null\")\n" +
10398
			"    private int E2;\n" +
10399
			"}\n" +
10400
			"class E3 {\n" +
10401
			"	 @p.NonNull\n" +
10402
			"    private int E3;\n" +
10403
			"}\n" +
10404
			"class E4 {\n" +
10405
			"	 @Deprecated\n" +
10406
			"	 @p.Annot\n" +
10407
			"    private int E4;\n" +
10408
			"}\n",
10409
			"p/NonNull.java",
10410
			"package p;\n" +
10411
			"import static java.lang.annotation.ElementType.*;\n" +
10412
			"import java.lang.annotation.*;\n" +
10413
			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE, FIELD})\n" +
10414
			"public @interface NonNull {\n" +
10415
			"}",
10416
			"p/Annot.java",
10417
			"package p;\n" +
10418
			"import static java.lang.annotation.ElementType.*;\n" +
10419
			"import java.lang.annotation.*;\n" +
10420
			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE, FIELD})\n" +
10421
			"public @interface Annot {\n" +
10422
			"}"
10423
		},
10424
		null, customOptions,
10425
		"----------\n" + 
10426
		"1. ERROR in Example.java (at line 7)\n" + 
10427
		"	private int E1;\n" + 
10428
		"	            ^^\n" + 
10429
		"The value of the field E1.E1 is not used\n" + 
10430
		"----------\n" + 
10431
		"2. WARNING in Example.java (at line 10)\n" + 
10432
		"	@SuppressWarnings(\"null\")\n" + 
10433
		"	                  ^^^^^^\n" + 
10434
		"Unnecessary @SuppressWarnings(\"null\")\n" + 
10435
		"----------\n" + 
10436
		"3. ERROR in Example.java (at line 11)\n" + 
10437
		"	private int E2;\n" + 
10438
		"	            ^^\n" + 
10439
		"The value of the field E2.E2 is not used\n" + 
10440
		"----------\n" + 
10441
		"4. ERROR in Example.java (at line 15)\n" + 
10442
		"	private int E3;\n" + 
10443
		"	            ^^\n" + 
10444
		"The value of the field E3.E3 is not used\n" + 
10445
		"----------\n",
10446
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10447
}
10448
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
10449
// unused type
10450
public void testBug365437f() {
10451
	Map customOptions = getCompilerOptions();
10452
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10453
	customOptions.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, CompilerOptions.ERROR);
10454
	customOptions.put(CompilerOptions.OPTION_AnnotationBasedNullAnalysis, CompilerOptions.ENABLED);
10455
	customOptions.put(CompilerOptions.OPTION_NonNullAnnotationName, "p.NonNull");
10456
	this.runNegativeTest(
10457
		true,
10458
		new String[] {
10459
			"Example.java",
10460
			"class Example {\n" +
10461
			"  @p.Annot\n" +
10462
			"  private class Ex{}\n" +
10463
			"}\n" +
10464
			"class E1 {\n" +
10465
			"	 @Deprecated\n" +
10466
			"    private class E11{}\n" +
10467
			"}\n" +
10468
			"class E2 {\n" +
10469
			"	 @SuppressWarnings(\"null\")\n" +
10470
			"    private class E22{}\n" +
10471
			"}\n" +
10472
			"class E3 {\n" +
10473
			"	 @p.NonNull\n" +
10474
			"    private class E33{}\n" +
10475
			"}\n" +
10476
			"class E4 {\n" +
10477
			"	 @Deprecated\n" +
10478
			"	 @p.Annot\n" +
10479
			"    private class E44{}\n" +
10480
			"}\n",
10481
			"p/NonNull.java",
10482
			"package p;\n" +
10483
			"import static java.lang.annotation.ElementType.*;\n" +
10484
			"import java.lang.annotation.*;\n" +
10485
			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE})\n" +
10486
			"public @interface NonNull {\n" +
10487
			"}",
10488
			"p/Annot.java",
10489
			"package p;\n" +
10490
			"import static java.lang.annotation.ElementType.*;\n" +
10491
			"import java.lang.annotation.*;\n" +
10492
			"@Target({TYPE, METHOD,PARAMETER,LOCAL_VARIABLE, CONSTRUCTOR})\n" +
10493
			"public @interface Annot {\n" +
10494
			"}"
10495
		},
10496
		null, customOptions,
10497
		"----------\n" + 
10498
		"1. ERROR in Example.java (at line 7)\n" + 
10499
		"	private class E11{}\n" + 
10500
		"	              ^^^\n" + 
10501
		"The type E1.E11 is never used locally\n" + 
10502
		"----------\n" + 
10503
		"2. WARNING in Example.java (at line 10)\n" + 
10504
		"	@SuppressWarnings(\"null\")\n" + 
10505
		"	                  ^^^^^^\n" + 
10506
		"Unnecessary @SuppressWarnings(\"null\")\n" + 
10507
		"----------\n" + 
10508
		"3. ERROR in Example.java (at line 11)\n" + 
10509
		"	private class E22{}\n" + 
10510
		"	              ^^^\n" + 
10511
		"The type E2.E22 is never used locally\n" + 
10512
		"----------\n" + 
10513
		"4. ERROR in Example.java (at line 15)\n" + 
10514
		"	private class E33{}\n" + 
10515
		"	              ^^^\n" + 
10516
		"The type E3.E33 is never used locally\n" + 
10517
		"----------\n",
10518
		JavacTestOptions.Excuse.EclipseWarningConfiguredAsError);
10519
}
10151
}
10520
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.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 167-178 Link Here
167
				break;
167
				break;
168
			case TypeIds.T_JavaLangInvokeMethodHandlePolymorphicSignature :
168
			case TypeIds.T_JavaLangInvokeMethodHandlePolymorphicSignature :
169
				tagBits |= TagBits.AnnotationPolymorphicSignature;
169
				tagBits |= TagBits.AnnotationPolymorphicSignature;
170
				break;
171
			case TypeIds.T_JavaxAnnotationPostConstruct :
172
				tagBits |= TagBits.AnnotationPostConstruct;
173
				break;
174
			case TypeIds.T_JavaxAnnotationPreDestroy :
175
				tagBits |= TagBits.AnnotationPreDestroy;
176
				break;
170
				break;
177
			case TypeIds.T_ConfiguredAnnotationNullable :
171
			case TypeIds.T_ConfiguredAnnotationNullable :
178
				tagBits |= TagBits.AnnotationNullable;
172
				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/lookup/AnnotationBinding.java (-10 / +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 54-64 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)
57
	if (count == 0) {
58
		count++;
58
		// this is possible if bits were set for null annotations
59
	if ((annotationTagBits & TagBits.AnnotationPreDestroy) != 0)
59
		return recordedAnnotations;
60
		count++;
60
	}
61
	// count must be different from 0
62
61
63
	int index = recordedAnnotations.length;
62
	int index = recordedAnnotations.length;
64
	AnnotationBinding[] result = new AnnotationBinding[index + count];
63
	AnnotationBinding[] result = new AnnotationBinding[index + count];
Lines 81-90 Link Here
81
		result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env);
80
		result[index++] = buildMarkerAnnotationForMemberType(TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE, env);
82
	if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
81
	if ((annotationTagBits & TagBits.AnnotationSafeVarargs) != 0)
83
		result[index++] = buildMarkerAnnotation(TypeConstants.JAVA_LANG_SAFEVARARGS, env);
82
		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;
83
	return result;
89
}
84
}
90
85
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ReferenceBinding.java (-16 / +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 380-387 Link Here
380
	switch (this.compoundName.length) {
380
	switch (this.compoundName.length) {
381
381
382
		case 3 :
382
		case 3 :
383
			if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0])
383
			if (!CharOperation.equals(TypeConstants.JAVA, this.compoundName[0]))
384
					&& !CharOperation.equals(TypeConstants.JAVAX, this.compoundName[0]))
385
				return;
384
				return;
386
			
385
			
387
			char[] packageName = this.compoundName[1];
386
			char[] packageName = this.compoundName[1];
Lines 389-407 Link Here
389
			char[] typeName = this.compoundName[2];
388
			char[] typeName = this.compoundName[2];
390
			if (typeName.length == 0) return; // just to be safe
389
			if (typeName.length == 0) return; // just to be safe
391
			// remaining types MUST be in java.*.*
390
			// remaining types MUST be in java.*.*
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])) {
391
			if (!CharOperation.equals(TypeConstants.LANG, this.compoundName[1])) {
406
				switch (packageName[0]) {
392
				switch (packageName[0]) {
407
					case 'i' :
393
					case 'i' :
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/TagBits.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 129-138 Link Here
129
	long AnnotationSafeVarargs = ASTNode.Bit52L;
129
	long AnnotationSafeVarargs = ASTNode.Bit52L;
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 */
133
	long AnnotationPreDestroy = ASTNode.Bit54L;
134
	/** @since 3.8 */
135
	long AnnotationPostConstruct = ASTNode.Bit55L;
136
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
132
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
137
	long AnnotationNullable = ASTNode.Bit56L;
133
	long AnnotationNullable = ASTNode.Bit56L;
138
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
134
	/** @since 3.8 null annotation for MethodBinding or LocalVariableBinding (argument): */
Lines 152-159 Link Here
152
				| AnnotationSuppressWarnings
148
				| AnnotationSuppressWarnings
153
				| AnnotationSafeVarargs
149
				| AnnotationSafeVarargs
154
				| AnnotationPolymorphicSignature
150
				| AnnotationPolymorphicSignature
155
				| AnnotationPostConstruct
156
				| AnnotationPreDestroy
157
				| AnnotationNullable
151
				| AnnotationNullable
158
				| AnnotationNonNull
152
				| AnnotationNonNull
159
				| AnnotationNonNullByDefault
153
				| 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 (-6 / +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 100-110 Link Here
100
100
101
	// java 7 java.lang.AutoCloseable
101
	// java 7 java.lang.AutoCloseable
102
	final int T_JavaLangAutoCloseable = 62;
102
	final int T_JavaLangAutoCloseable = 62;
103
104
	// new in 3.8
105
	final int T_JavaxAnnotationPostConstruct = 63;
106
107
	final int T_JavaxAnnotationPreDestroy = 64;
108
	
103
	
109
	// new in 3.8 for null annotations:
104
	// new in 3.8 for null annotations:
110
	final int T_ConfiguredAnnotationNullable = 65;
105
	final int T_ConfiguredAnnotationNullable = 65;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-7 / +41 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 7592-7598 Link Here
7592
7592
7593
	int severity = computeSeverity(IProblem.UnusedPrivateConstructor);
7593
	int severity = computeSeverity(IProblem.UnusedPrivateConstructor);
7594
	if (severity == ProblemSeverities.Ignore) return;
7594
	if (severity == ProblemSeverities.Ignore) return;
7595
7595
	
7596
	if (excludeDueToAnnotation(constructorDecl.annotations)) return;
7597
	
7596
	MethodBinding constructor = constructorDecl.binding;
7598
	MethodBinding constructor = constructorDecl.binding;
7597
	this.handle(
7599
	this.handle(
7598
			IProblem.UnusedPrivateConstructor,
7600
			IProblem.UnusedPrivateConstructor,
Lines 7638-7643 Link Here
7638
			}
7640
			}
7639
		}
7641
		}
7640
	}
7642
	}
7643
	if (excludeDueToAnnotation(fieldDecl.annotations)) return;
7641
	this.handle(
7644
	this.handle(
7642
			IProblem.UnusedPrivateField,
7645
			IProblem.UnusedPrivateField,
7643
		new String[] {
7646
		new String[] {
Lines 7691-7700 Link Here
7691
			&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
7694
			&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
7692
		return;
7695
		return;
7693
	}
7696
	}
7694
	if ((method.tagBits & (TagBits.AnnotationPostConstruct | TagBits.AnnotationPreDestroy)) != 0) {
7697
	if (excludeDueToAnnotation(methodDecl.annotations)) return;
7695
		// PostConstruct and PreDestroy method are ignored
7698
	
7696
		return;
7697
	}
7698
	this.handle(
7699
	this.handle(
7699
			IProblem.UnusedPrivateMethod,
7700
			IProblem.UnusedPrivateMethod,
7700
		new String[] {
7701
		new String[] {
Lines 7711-7720 Link Here
7711
		methodDecl.sourceStart,
7712
		methodDecl.sourceStart,
7712
		methodDecl.sourceEnd);
7713
		methodDecl.sourceEnd);
7713
}
7714
}
7715
7716
/**
7717
 * Returns true if a private member should not be warned as unused if
7718
 * annotated with a non-standard annotation
7719
 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365437
7720
 */
7721
private boolean excludeDueToAnnotation(Annotation[] annotations) {
7722
	int annotationsLen = 0;
7723
	if (annotations != null) {
7724
		annotationsLen = annotations.length;
7725
	} else {
7726
		return false;
7727
	}
7728
	if (annotationsLen == 0) return false;
7729
	for (int i = 0; i < annotationsLen; i++) {
7730
		 TypeBinding resolvedType = annotations[i].resolvedType;
7731
	     if (resolvedType != null) {
7732
			switch (resolvedType.id) {
7733
				case TypeIds.T_JavaLangSuppressWarnings:
7734
				case TypeIds.T_JavaLangDeprecated:
7735
				case TypeIds.T_JavaLangSafeVarargs:
7736
				case TypeIds.T_ConfiguredAnnotationNonNull:
7737
				case TypeIds.T_ConfiguredAnnotationNullable:
7738
				case TypeIds.T_ConfiguredAnnotationNonNullByDefault:
7739
					break;
7740
				default:
7741
					// non-standard annotation found, don't warn
7742
					return true;
7743
			}
7744
		}
7745
	}
7746
	return false;
7747
}
7714
public void unusedPrivateType(TypeDeclaration typeDecl) {
7748
public void unusedPrivateType(TypeDeclaration typeDecl) {
7715
	int severity = computeSeverity(IProblem.UnusedPrivateType);
7749
	int severity = computeSeverity(IProblem.UnusedPrivateType);
7716
	if (severity == ProblemSeverities.Ignore) return;
7750
	if (severity == ProblemSeverities.Ignore) return;
7717
7751
	if (excludeDueToAnnotation(typeDecl.annotations)) return;
7718
	ReferenceBinding type = typeDecl.binding;
7752
	ReferenceBinding type = typeDecl.binding;
7719
	this.handle(
7753
	this.handle(
7720
			IProblem.UnusedPrivateType,
7754
			IProblem.UnusedPrivateType,
(-)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 / +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 46-51 Link Here
46
		super(document);
46
		super(document);
47
	}
47
	}
48
	private void addBinaryStandardAnnotations(long annotationTagBits) {
48
	private void addBinaryStandardAnnotations(long annotationTagBits) {
49
		if ((annotationTagBits & TagBits.AllStandardAnnotationsMask) == 0) {
50
			return;
51
		}
49
		if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) {
52
		if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) {
50
			char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_TARGET;
53
			char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_TARGET;
51
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
54
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
Lines 83-96 Link Here
83
		if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
86
		if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
84
			char[][] compoundName =
87
			char[][] compoundName =
85
					TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
88
					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]);
89
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
95
		}
90
		}
96
	}
91
	}
(-)a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java (-13 / +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 90-95 Link Here
90
	return true;
90
	return true;
91
}
91
}
92
private boolean checkStandardAnnotations(long annotationTagBits, TypeReferencePattern pattern) {
92
private boolean checkStandardAnnotations(long annotationTagBits, TypeReferencePattern pattern) {
93
	if ((annotationTagBits & TagBits.AllStandardAnnotationsMask) == 0) {
94
		return false;
95
	}
93
	if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) {
96
	if ((annotationTagBits & TagBits.AnnotationTargetMASK) != 0) {
94
		char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_TARGET;
97
		char[][] compoundName = TypeConstants.JAVA_LANG_ANNOTATION_TARGET;
95
		if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern) ||
98
		if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern) ||
Lines 142-159 Link Here
142
	}
145
	}
143
	if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
146
	if ((annotationTagBits & TagBits.AnnotationPolymorphicSignature) != 0) {
144
		char[][] compoundName = TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
147
		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)) {
148
		if (checkAnnotationTypeReference(CharOperation.concatWith(compoundName, '.'), pattern)) {
158
			return true;
149
			return true;
159
		}
150
		}

Return to bug 365437