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/NonFatalErrorTest.java (-1 / +39 lines)
Lines 12-17 package org.eclipse.jdt.core.tests.compiler.regression; Link Here
12
12
13
import java.util.Map;
13
import java.util.Map;
14
14
15
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
15
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
16
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
16
17
17
import junit.framework.Test;
18
import junit.framework.Test;
Lines 24-30 public class NonFatalErrorTest extends AbstractRegressionTest { Link Here
24
	// All specified tests which does not belong to the class are skipped...
25
	// All specified tests which does not belong to the class are skipped...
25
	static {
26
	static {
26
//		TESTS_NAMES = new String[] { "test127" };
27
//		TESTS_NAMES = new String[] { "test127" };
27
//		TESTS_NUMBERS = new int[] { 5 };
28
//		TESTS_NUMBERS = new int[] { 7 };
28
//		TESTS_RANGE = new int[] { 169, 180 };
29
//		TESTS_RANGE = new int[] { 169, 180 };
29
	}
30
	}
30
31
Lines 258-261 public class NonFatalErrorTest extends AbstractRegressionTest { Link Here
258
			// javac options
259
			// javac options
259
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
260
			JavacTestOptions.Excuse.EclipseWarningConfiguredAsError /* javac test options */);
260
	}
261
	}
262
	public void test007() {
263
		if (this.complianceLevel < ClassFileConstants.JDK1_5) {
264
			return;
265
		}
266
		Map customOptions = getCompilerOptions();
267
		customOptions.put(CompilerOptions.OPTION_FatalOptionalError,
268
				CompilerOptions.ENABLED);
269
		customOptions.put(CompilerOptions.OPTION_ReportUnusedLocal,
270
				CompilerOptions.ERROR);
271
		customOptions.put(CompilerOptions.OPTION_SuppressWarnings,
272
				CompilerOptions.ENABLED);
273
		customOptions.put(CompilerOptions.OPTION_SuppressOptionalErrors,
274
				CompilerOptions.ENABLED);
275
		customOptions.put(CompilerOptions.OPTION_ReportUnusedWarningToken,
276
				CompilerOptions.ERROR);
277
		runConformTest(
278
				new String[] { /* test files */
279
						"X.java",
280
						"public class X {\n" +
281
								"        @SuppressWarnings(\"unused\")\n" +
282
								"        static void foo() {\n" +
283
								"            String s = null;\n" +
284
								"            System.out.println(\"SUCCESS\");\n" +
285
								"        }\n" +
286
								"        public static void main(String argv[]) {\n" +
287
								"            foo();\n" +
288
								"        }\n" +
289
								"}"
290
				},
291
				"SUCCESS" /* expected output string */,
292
				null /* no class libraries */,
293
				true,
294
				null,
295
				customOptions /* custom options */,
296
				// compiler results
297
				null /* do not check error string */);
298
	}
261
}
299
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/AbstractMethodDeclaration.java (+9 lines)
Lines 392-397 public abstract class AbstractMethodDeclaration Link Here
392
		return false;
392
		return false;
393
	}
393
	}
394
394
395
	public boolean isFiltered(CategorizedProblem problem) {
396
		if (this.scope == null) return false;
397
		CompilationUnitScope compilationUnitScope = this.scope.compilationUnitScope();
398
		if (compilationUnitScope == null) return false;
399
		CompilationUnitDeclaration referenceContext = compilationUnitScope.referenceContext;
400
		if (referenceContext == null) return false;
401
		return referenceContext.filterProblem(problem);
402
	}
403
395
	public boolean isInitializationMethod() {
404
	public boolean isInitializationMethod() {
396
405
397
		return false;
406
		return false;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Annotation.java (-6 lines)
Lines 168-179 public abstract class Annotation extends Expression { 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 :
172
				tagBits |= TagBits.AnnotationPostConstruct;
173
				break;
174
			case TypeIds.T_JavaxAnnotationPreDestroy :
175
				tagBits |= TagBits.AnnotationPreDestroy;
176
				break;
177
			case TypeIds.T_ConfiguredAnnotationNullable :
171
			case TypeIds.T_ConfiguredAnnotationNullable :
178
				tagBits |= TagBits.AnnotationNullable;
172
				tagBits |= TagBits.AnnotationNullable;
179
				break;
173
				break;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/CompilationUnitDeclaration.java (-2 / +35 lines)
Lines 339-345 public void finalizeProblems() { Link Here
339
		}
339
		}
340
	}
340
	}
341
}
341
}
342
342
public boolean filterProblem(CategorizedProblem problem) {
343
	if (this.suppressWarningsCount == 0) return false;
344
	CompilerOptions options = this.scope.compilerOptions();
345
	int problemID = problem.getID();
346
	int irritant = ProblemReporter.getIrritant(problemID);
347
	boolean isError = problem.isError();
348
	if (isError) {
349
		if (irritant == 0) {
350
			return false;
351
		}
352
		if (!options.suppressOptionalErrors) {
353
			return false;
354
		}
355
	}
356
	int start = problem.getSourceStart();
357
	int end = problem.getSourceEnd();
358
	nextSuppress: for (int iSuppress = 0, suppressCount = this.suppressWarningsCount; iSuppress < suppressCount; iSuppress++) {
359
		long position = this.suppressWarningScopePositions[iSuppress];
360
		int startSuppress = (int) (position >>> 32);
361
		int endSuppress = (int) position;
362
		if (start < startSuppress) continue nextSuppress;
363
		if (end > endSuppress) continue nextSuppress;
364
		if (!this.suppressWarningIrritants[iSuppress].isSet(irritant))
365
			continue nextSuppress;
366
		// discard suppressed warning
367
		return true;
368
	}
369
	return false;
370
}
343
/**
371
/**
344
 * Bytecode generation
372
 * Bytecode generation
345
 */
373
 */
Lines 389-395 public char[] getMainTypeName() { Link Here
389
public boolean isEmpty() {
417
public boolean isEmpty() {
390
	return (this.currentPackage == null) && (this.imports == null) && (this.types == null);
418
	return (this.currentPackage == null) && (this.imports == null) && (this.types == null);
391
}
419
}
392
420
public boolean isFiltered(CategorizedProblem problem) {
421
	if (this.scope == null) return false;
422
	CompilationUnitDeclaration referenceContext = this.scope.referenceContext;
423
	if (referenceContext == null) return false;
424
	return referenceContext.filterProblem(problem);
425
}
393
public boolean isPackageInfo() {
426
public boolean isPackageInfo() {
394
	return CharOperation.equals(getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME);
427
	return CharOperation.equals(getMainTypeName(), TypeConstants.PACKAGE_INFO_NAME);
395
}
428
}
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TypeDeclaration.java (-1 / +8 lines)
Lines 709-715 private void internalAnalyseCode(FlowContext flowContext, FlowInfo flowInfo) { Link Here
709
		this.enumValuesSyntheticfield = this.binding.addSyntheticFieldForEnumValues();
709
		this.enumValuesSyntheticfield = this.binding.addSyntheticFieldForEnumValues();
710
	}
710
	}
711
}
711
}
712
712
public boolean isFiltered(CategorizedProblem problem) {
713
	if (this.scope == null) return false;
714
	CompilationUnitScope compilationUnitScope = this.scope.compilationUnitScope();
715
	if (compilationUnitScope == null) return false;
716
	CompilationUnitDeclaration referenceContext = compilationUnitScope.referenceContext;
717
	if (referenceContext == null) return false;
718
	return referenceContext.filterProblem(problem);
719
}
713
public final static int kind(int flags) {
720
public final static int kind(int flags) {
714
	switch (flags & (ClassFileConstants.AccInterface|ClassFileConstants.AccAnnotation|ClassFileConstants.AccEnum)) {
721
	switch (flags & (ClassFileConstants.AccInterface|ClassFileConstants.AccAnnotation|ClassFileConstants.AccEnum)) {
715
		case ClassFileConstants.AccInterface :
722
		case ClassFileConstants.AccInterface :
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/classfmt/AnnotationInfo.java (-8 lines)
Lines 303-312 private int scanAnnotation(int offset, boolean expectRuntimeVisibleAnno, boolean 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 317-326 private int scanAnnotation(int offset, boolean expectRuntimeVisibleAnno, boolean Link Here
317
					this.standardAnnotationTagBits |= TagBits.AnnotationInherited;
313
					this.standardAnnotationTagBits |= TagBits.AnnotationInherited;
318
					return currentOffset;
314
					return currentOffset;
319
				}
315
				}
320
				if (CharOperation.equals(typeName, ConstantPool.JAVAX_ANNOTATION_POSTCONSTRUCT)) {
321
					this.standardAnnotationTagBits |= TagBits.AnnotationPostConstruct;
322
					return currentOffset;
323
				}
324
				break;
316
				break;
325
			case 33:
317
			case 33:
326
				if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_DOCUMENTED)) {
318
				if (CharOperation.equals(typeName, ConstantPool.JAVA_LANG_ANNOTATION_DOCUMENTED)) {
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/codegen/ConstantPool.java (-2 lines)
Lines 248-255 public class ConstantPool implements ClassFileConstants, TypeIds { 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/ReferenceContext.java (-1 / +3 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 25-30 public interface ReferenceContext { Link Here
25
25
26
	CompilationResult compilationResult();
26
	CompilationResult compilationResult();
27
27
28
	boolean isFiltered(CategorizedProblem problem);
29
28
	boolean hasErrors();
30
	boolean hasErrors();
29
31
30
	void tagAsHavingErrors();
32
	void tagAsHavingErrors();
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/AnnotationBinding.java (-9 / +4 lines)
Lines 54-64 public static AnnotationBinding[] addStandardAnnotations(AnnotationBinding[] rec 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 public static AnnotationBinding[] addStandardAnnotations(AnnotationBinding[] rec 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 380-407 public void computeId() { 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];
388
			if (packageName.length == 0) return; // just to be safe
387
			if (packageName.length == 0) return; // just to be safe
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 (-6 lines)
Lines 129-138 public interface TagBits { 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 public interface TagBits { 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 (-12 lines)
Lines 177-194 public interface TypeConstants { 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 (-5 lines)
Lines 100-110 public interface TypeIds { 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/ProblemHandler.java (-1 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 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 150-155 public void handle( Link Here
150
		case ProblemSeverities.Error :
150
		case ProblemSeverities.Error :
151
			record(problem, unitResult, referenceContext);
151
			record(problem, unitResult, referenceContext);
152
			if ((severity & ProblemSeverities.Fatal) != 0) {
152
			if ((severity & ProblemSeverities.Fatal) != 0) {
153
				if ((severity & ProblemSeverities.Optional) != 0 && referenceContext.isFiltered(problem)) {
154
					// don't abort for optional problem treated as fatal if ignored with @SuppressWarnings
155
					return;
156
				}
153
				referenceContext.tagAsHavingErrors();
157
				referenceContext.tagAsHavingErrors();
154
				// should abort ?
158
				// should abort ?
155
				int abortLevel;
159
				int abortLevel;
(-)a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java (-3 / +11 lines)
Lines 88-93 import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; Link Here
88
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
88
import org.eclipse.jdt.internal.compiler.flow.FlowInfo;
89
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
89
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
90
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
90
import org.eclipse.jdt.internal.compiler.impl.ReferenceContext;
91
import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding;
91
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
92
import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
92
import org.eclipse.jdt.internal.compiler.lookup.Binding;
93
import org.eclipse.jdt.internal.compiler.lookup.Binding;
93
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
94
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
Lines 7691-7699 public void unusedPrivateMethod(AbstractMethodDeclaration methodDecl) { Link Here
7691
			&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
7692
			&& CharOperation.equals(method.selector, TypeConstants.WRITEREPLACE)) {
7692
		return;
7693
		return;
7693
	}
7694
	}
7694
	if ((method.tagBits & (TagBits.AnnotationPostConstruct | TagBits.AnnotationPreDestroy)) != 0) {
7695
	AnnotationBinding[] annotations = method.getAnnotations();
7695
		// PostConstruct and PreDestroy method are ignored
7696
	int annotationsLength = annotations.length;
7696
		return;
7697
	if (annotationsLength > 0) {
7698
		for (int i = 0; i < annotationsLength; i++) {
7699
			char[][] annotationName = annotations[0].getAnnotationType().compoundName;
7700
			if (annotationName.length > 1
7701
					&& CharOperation.equals(annotationName[0], TypeConstants.JAVAX)) {
7702
				return;
7703
			}
7704
		}
7697
	}
7705
	}
7698
	this.handle(
7706
	this.handle(
7699
			IProblem.UnusedPrivateMethod,
7707
			IProblem.UnusedPrivateMethod,
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/BinaryMember.java (-6 lines)
Lines 87-98 protected IAnnotation[] getStandardAnnotations(long tagBits) { Link Here
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
	}
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
	}
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()]);
98
}
92
}
(-)a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClassFileInfo.java (-6 lines)
Lines 108-119 private void generateStandardAnnotationsInfos(JavaElement javaElement, char[] pa Link Here
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
	}
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
	}
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
}
119
113
(-)a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/indexing/BinaryIndexer.java (-8 / +3 lines)
Lines 46-51 public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { 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 85-98 public class BinaryIndexer extends AbstractIndexer implements SuffixConstants { Link Here
85
					TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
88
					TypeConstants.JAVA_LANG_INVOKE_METHODHANDLE_$_POLYMORPHICSIGNATURE;
86
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
89
			addAnnotationTypeReference(compoundName[compoundName.length-1]);
87
		}
90
		}
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]);
95
		}
96
	}
91
	}
97
	private void addBinaryTargetAnnotation(long bits) {
92
	private void addBinaryTargetAnnotation(long bits) {
98
		char[][] compoundName = null;
93
		char[][] compoundName = null;
(-)a/org.eclipse.jdt.core/search/org/eclipse/jdt/internal/core/search/matching/ClassFileMatchLocator.java (-12 / +3 lines)
Lines 90-95 private boolean checkParameters(char[] methodDescriptor, char[][] parameterSimpl 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 146-163 private boolean checkStandardAnnotations(long annotationTagBits, TypeReferencePa Link Here
146
			return true;
149
			return true;
147
		}
150
		}
148
	}
151
	}
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)) {
158
			return true;
159
		}
160
	}
161
	return false;
152
	return false;
162
}
153
}
163
private boolean checkTypeName(char[] simpleName, char[] qualification, char[] fullyQualifiedTypeName, boolean isCaseSensitive, boolean isCamelCase) {
154
private boolean checkTypeName(char[] simpleName, char[] qualification, char[] fullyQualifiedTypeName, boolean isCaseSensitive, boolean isCamelCase) {

Return to bug 365437