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 189900 Details for
Bug 338303
[compiler][null] Warning about Redundant assignment conflicts with definite assignment analysis
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
test & proposed fix
Bug_338303.patch (text/plain), 3.60 KB, created by
Stephan Herrmann
on 2011-02-27 14:23:56 EST
(
hide
)
Description:
test & proposed fix
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-02-27 14:23:56 EST
Size:
3.60 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java,v >retrieving revision 1.432 >diff -u -r1.432 ProblemReporter.java >--- compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 16 Feb 2011 07:56:50 -0000 1.432 >+++ compiler/org/eclipse/jdt/internal/compiler/problem/ProblemReporter.java 27 Feb 2011 19:15:19 -0000 >@@ -8,7 +8,9 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Benjamin Muskalla - Contribution for bug 239066 >- * Stephan Herrmann - Contribution for bug 236385 >+ * Stephan Herrmann - Contributions for >+ * bug 236385 - >+ * bug 338303 - Warning about Redundant assignment conflicts with definite assignment > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.problem; > >@@ -4981,6 +4983,8 @@ > } > > public void localVariableRedundantNullAssignment(LocalVariableBinding local, ASTNode location) { >+ if ((location.bits & ASTNode.FirstAssignmentToLocal) != 0) // https://bugs.eclipse.org/338303 - Warning about Redundant assignment conflicts with definite assignment >+ return; > int severity = computeSeverity(IProblem.RedundantLocalVariableNullAssignment); > if (severity == ProblemSeverities.Ignore) return; > String[] arguments = new String[] {new String(local.name) }; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java,v >retrieving revision 1.112 >diff -u -r1.112 NullReferenceTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 16 Feb 2011 18:57:51 -0000 1.112 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 27 Feb 2011 19:15:39 -0000 >@@ -8,7 +8,7 @@ > * Contributors: > * IBM Corporation - initial API and implementation > * Stephan Herrmann <stephan@cs.tu-berlin.de> - Contributions for >- * bugs 325755, 133125, 292478, 319201, 320170 and 332637 >+ * bugs 325755, 133125, 292478, 319201, 320170, 332637 and 338303 > *******************************************************************************/ > package org.eclipse.jdt.core.tests.compiler.regression; > >@@ -14025,4 +14025,33 @@ > }, > ""); > } >+// https://bugs.eclipse.org/338303 - Warning about Redundant assignment conflicts with definite assignment >+public void testBug338303() { >+ this.runConformTest( >+ new String[] { >+ "Bug338303.java", >+ "import java.io.File;\n" + >+ "import java.io.IOException;\n" + >+ "\n" + >+ "public class Bug338303 {\n" + >+ " Object test(Object in, final File f) {\n" + >+ " Object local;\n" + >+ " try {\n" + >+ " local = in;\n" + >+ " if (local == null)\n" + >+ " local = loadEntry(f, false);\n" + >+ " } catch (final IOException e) {\n" + >+ " e.printStackTrace();\n" + >+ " local = null;\n" + >+ " }\n" + >+ " return local;\n" + >+ " }\n" + >+ "\n" + >+ " private Object loadEntry(File f, boolean b) throws IOException {\n" + >+ " throw new IOException();\n" + >+ " }\n" + >+ "}\n" >+ }, >+ ""); >+} > } >\ No newline at end of file
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 338303
: 189900