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 152575 Details for
Bug 295260
Wrong warnings on Java.Compiler.Errors/Warnings "Redundant null check"
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed fix v0.5 + regression test
patchWrongWarnings.txt (text/plain), 5.64 KB, created by
Ayushman Jain
on 2009-11-19 08:38:19 EST
(
hide
)
Description:
proposed fix v0.5 + regression test
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2009-11-19 08:38:19 EST
Size:
5.64 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java,v >retrieving revision 1.113 >diff -u -r1.113 TryStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 7 Mar 2009 00:58:58 -0000 1.113 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 19 Nov 2009 13:38:57 -0000 >@@ -131,10 +131,7 @@ > addPotentialInitializationsFrom( > handlingContext.initsOnException( > this.caughtExceptionTypes[i])) >- .addPotentialInitializationsFrom( >- tryInfo.nullInfoLessUnconditionalCopy()) >- // remove null info to protect point of >- // exception null info >+ .addPotentialInitializationsFrom(tryInfo.unconditionalCopy()) > .addPotentialInitializationsFrom( > handlingContext.initsOnReturn. > nullInfoLessUnconditionalCopy()); >@@ -243,10 +240,7 @@ > .addPotentialInitializationsFrom( > handlingContext.initsOnException( > this.caughtExceptionTypes[i])) >- .addPotentialInitializationsFrom( >- tryInfo.nullInfoLessUnconditionalCopy()) >- // remove null info to protect point of >- // exception null info >+ .addPotentialInitializationsFrom(tryInfo.unconditionalCopy()) > .addPotentialInitializationsFrom( > handlingContext.initsOnReturn. > nullInfoLessUnconditionalCopy()); >Index: compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java,v >retrieving revision 1.29 >diff -u -r1.29 FinallyFlowContext.java >--- compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java 7 Mar 2009 01:08:10 -0000 1.29 >+++ compiler/org/eclipse/jdt/internal/compiler/flow/FinallyFlowContext.java 19 Nov 2009 13:38:58 -0000 >@@ -192,7 +192,7 @@ > if (flowInfo.cannotBeNull(local)) { > if (checkType == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NON_NULL)) { > scope.problemReporter().localVariableRedundantCheckOnNonNull(local, reference); >- } else { >+ } else if (checkType == (CAN_ONLY_NULL_NON_NULL | IN_COMPARISON_NULL)) { > scope.problemReporter().localVariableNonNullComparedToNull(local, reference); > } > return; >#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.81 >diff -u -r1.81 NullReferenceTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 27 Aug 2009 15:26:58 -0000 1.81 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 19 Nov 2009 13:39:11 -0000 >@@ -5347,6 +5347,29 @@ > false /* skipJavac */); > } > >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=295260 >+public void test0535_try_finally() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public void test3(String[] args) {\n" + >+ " while (true) {\n" + >+ " Object a = null;\n" + >+ " try {\n" + >+ " a = new Object();\n" + >+ " } catch (Exception e) {\n" + >+ " } finally {\n" + >+ " if (a != null)\n" + >+ " a = null;\n" + // quiet >+ " }\n" + >+ " }\n" + >+ " }\n"+ >+ "}", >+ }, >+ ""); >+} >+ > // null analysis -- try/catch > public void test0550_try_catch() { > this.runConformTest( >@@ -5859,6 +5882,59 @@ > ""); > } > >+// null analysis - try/catch for checked exceptions >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=295260 >+public void test0567_try_catch_checked_exception() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.net.MalformedURLException;\n" + >+ "import java.net.URL;\n" + >+ "public class X {\n" + >+ " public void test1(String[] args) {\n" + >+ " URL[] urls = null;\n" + >+ " try {\n" + >+ " urls = new URL[args.length];\n" + >+ " for (int i = 0; i < args.length; i++)\n" + >+ " urls[i] = new URL(\"http\", \"\", -1, args[i]);\n" + >+ " }\n" + >+ " catch (MalformedURLException mfex) {\n" + >+ " urls = null;\n" + // quiet >+ " }\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+} >+ >+// null analysis - try/catch for checked exceptions with finally block >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=295260 >+public void test0568_try_catch_checked_exception() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.net.MalformedURLException;\n" + >+ "import java.net.URL;\n" + >+ "public class X {\n" + >+ " public void test1(String[] args) {\n" + >+ " URL[] urls = null;\n" + >+ " try {\n" + >+ " urls = new URL[args.length];\n" + >+ " for (int i = 0; i < args.length; i++)\n" + >+ " urls[i] = new URL(\"http\", \"\", -1, args[i]);\n" + >+ " }\n" + >+ " catch (MalformedURLException mfex) {\n" + >+ " urls = null;\n" + // quiet >+ " }\n" + >+ " finally{\n"+ >+ " System.out.println(\"complete\");\n" + >+ " }\n" + >+ " }\n" + >+ "}", >+ }, >+ ""); >+} >+ > // null analysis - throw > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=201182 > public void test0595_throw() {
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
Flags:
Olivier_Thomann
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 295260
:
152308
| 152575