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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java (-1 / +10 lines)
Lines 590-596 Link Here
590
						break;
590
						break;
591
					case Binding.LOCAL :
591
					case Binding.LOCAL :
592
						LocalVariableBinding local = (LocalVariableBinding) recipient;
592
						LocalVariableBinding local = (LocalVariableBinding) recipient;
593
						local.tagBits = ((LocalVariableBinding) annotationRecipient).tagBits;
593
						long otherLocalTagBits = ((LocalVariableBinding) annotationRecipient).tagBits;
594
						local.tagBits = otherLocalTagBits;
595
						/*
596
						 * Annotations are shared between two locals, but we still need to record
597
						 * the suppress annotation range for the second local
598
						 */
599
						if ((otherLocalTagBits & TagBits.AnnotationSuppressWarnings) != 0) {
600
							LocalDeclaration localDeclaration = local.declaration;
601
							annotation.recordSuppressWarnings(scope, localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings);
602
						}
594
						break;
603
						break;
595
				}
604
				}
596
				if (annotations != null) {
605
				if (annotations != null) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java (-1 / +55 lines)
Lines 45-51 Link Here
45
	// All specified tests which do not belong to the class are skipped...
45
	// All specified tests which do not belong to the class are skipped...
46
	static {
46
	static {
47
//		TESTS_NAMES = new String[] { "test127" };
47
//		TESTS_NAMES = new String[] { "test127" };
48
//		TESTS_NUMBERS = new int[] { 286 };
48
//		TESTS_NUMBERS = new int[] { 287, 288 };
49
//		TESTS_RANGE = new int[] { 249, -1 };
49
//		TESTS_RANGE = new int[] { 249, -1 };
50
	}
50
	}
51
51
Lines 9518-9521 Link Here
9518
		raiseDeprecationReduceInvalidJavadocSeverity,
9518
		raiseDeprecationReduceInvalidJavadocSeverity,
9519
		null);
9519
		null);
9520
}
9520
}
9521
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031
9522
public void test287() {
9523
	Map options = getCompilerOptions();
9524
	options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);
9525
	options.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED);
9526
	this.runConformTest(
9527
		new String[] {
9528
				"X.java",
9529
				"import java.util.ArrayList;\n" + 
9530
				"\n" + 
9531
				"public class X {\n" + 
9532
				"	@SuppressWarnings(\"rawtypes\")\n" + 
9533
				"	void foo(ArrayList arg) {\n" + 
9534
				"		for (\n" + 
9535
				"			@SuppressWarnings(\"unchecked\")\n" +
9536
				"			boolean a= arg.add(1), b= arg.add(1);\n" + 
9537
				"			Boolean.FALSE;\n" + 
9538
				"		) {\n" + 
9539
				"			System.out.println(a && b);\n" + 
9540
				"		}\n" + 
9541
				"	}\n" + 
9542
				"}",
9543
		},
9544
		"",
9545
		null,
9546
		true,
9547
		null,
9548
		options,
9549
		null);
9550
}
9551
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031
9552
public void test288() {
9553
	Map options = getCompilerOptions();
9554
	options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR);
9555
	options.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED);
9556
	this.runConformTest(
9557
		new String[] {
9558
				"X.java",
9559
				"import java.util.ArrayList;\n" + 
9560
				"\n" + 
9561
				"public class X {\n" + 
9562
				"	@SuppressWarnings(\"rawtypes\")\n" + 
9563
				"	ArrayList arg;\n" + 
9564
				"	@SuppressWarnings(\"unchecked\")\n" + 
9565
				"	boolean a= arg.add(1), b= arg.add(1);\n" + 
9566
				"}",
9567
		},
9568
		"",
9569
		null,
9570
		true,
9571
		null,
9572
		options,
9573
		null);
9574
}
9521
}
9575
}

Return to bug 311849