Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 167310 Details for
Bug 311849
[quick fix] @SuppressWarnings does not work as expected inside a for loop
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_311849.txt (text/plain), 3.90 KB, created by
Olivier Thomann
on 2010-05-06 10:23:52 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2010-05-06 10:23:52 EDT
Size:
3.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java,v >retrieving revision 1.101 >diff -u -r1.101 ASTNode.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 11 Feb 2010 01:32:26 -0000 1.101 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/ASTNode.java 6 May 2010 14:23:27 -0000 >@@ -590,7 +590,16 @@ > break; > case Binding.LOCAL : > LocalVariableBinding local = (LocalVariableBinding) recipient; >- local.tagBits = ((LocalVariableBinding) annotationRecipient).tagBits; >+ long otherLocalTagBits = ((LocalVariableBinding) annotationRecipient).tagBits; >+ local.tagBits = otherLocalTagBits; >+ /* >+ * Annotations are shared between two locals, but we still need to record >+ * the suppress annotation range for the second local >+ */ >+ if ((otherLocalTagBits & TagBits.AnnotationSuppressWarnings) != 0) { >+ LocalDeclaration localDeclaration = local.declaration; >+ annotation.recordSuppressWarnings(scope, localDeclaration.declarationSourceStart, localDeclaration.declarationSourceEnd, scope.compilerOptions().suppressWarnings); >+ } > break; > } > if (annotations != null) { >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java,v >retrieving revision 1.214 >diff -u -r1.214 AnnotationTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 18 Mar 2010 16:22:36 -0000 1.214 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AnnotationTest.java 6 May 2010 14:23:30 -0000 >@@ -45,7 +45,7 @@ > // All specified tests which do not belong to the class are skipped... > static { > // TESTS_NAMES = new String[] { "test127" }; >-// TESTS_NUMBERS = new int[] { 286 }; >+// TESTS_NUMBERS = new int[] { 287, 288 }; > // TESTS_RANGE = new int[] { 249, -1 }; > } > >@@ -9518,4 +9518,58 @@ > raiseDeprecationReduceInvalidJavadocSeverity, > null); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031 >+public void test287() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "\n" + >+ "public class X {\n" + >+ " @SuppressWarnings(\"rawtypes\")\n" + >+ " void foo(ArrayList arg) {\n" + >+ " for (\n" + >+ " @SuppressWarnings(\"unchecked\")\n" + >+ " boolean a= arg.add(1), b= arg.add(1);\n" + >+ " Boolean.FALSE;\n" + >+ " ) {\n" + >+ " System.out.println(a && b);\n" + >+ " }\n" + >+ " }\n" + >+ "}", >+ }, >+ "", >+ null, >+ true, >+ null, >+ options, >+ null); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031 >+public void test288() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportUncheckedTypeOperation, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.util.ArrayList;\n" + >+ "\n" + >+ "public class X {\n" + >+ " @SuppressWarnings(\"rawtypes\")\n" + >+ " ArrayList arg;\n" + >+ " @SuppressWarnings(\"unchecked\")\n" + >+ " boolean a= arg.add(1), b= arg.add(1);\n" + >+ "}", >+ }, >+ "", >+ null, >+ true, >+ null, >+ options, >+ null); >+} > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 311849
: 167310 |
167791