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 203976 Details for
Bug 358827
[1.7] exception analysis for t-w-r spoils null analysis
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
test and proposed fix
Bug_358827.patch (text/plain), 4.79 KB, created by
Stephan Herrmann
on 2011-09-25 17:34:02 EDT
(
hide
)
Description:
test and proposed fix
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-09-25 17:34:02 EDT
Size:
4.79 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.121 >diff -u -r1.121 TryStatement.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 18 Aug 2011 17:07:34 -0000 1.121 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/TryStatement.java 25 Sep 2011 21:30:28 -0000 >@@ -258,7 +258,7 @@ > if (closeMethod != null && closeMethod.returnType.id == TypeIds.T_void) { > ReferenceBinding[] thrownExceptions = closeMethod.thrownExceptions; > for (int j = 0, length = thrownExceptions.length; j < length; j++) { >- handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[j], flowInfo, currentScope); >+ handlingContext.checkExceptionHandlers(thrownExceptions[j], this.resources[j], flowInfo, currentScope, true); > } > } > } >Index: compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java,v >retrieving revision 1.71 >diff -u -r1.71 FlowContext.java >--- compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java 28 Jul 2011 17:07:43 -0000 1.71 >+++ compiler/org/eclipse/jdt/internal/compiler/flow/FlowContext.java 25 Sep 2011 21:30:29 -0000 >@@ -197,11 +197,13 @@ > > traversedContext.recordReturnFrom(flowInfo.unconditionalInits()); > >- if (traversedContext instanceof InsideSubRoutineFlowContext) { >- ASTNode node = traversedContext.associatedNode; >- if (node instanceof TryStatement) { >- TryStatement tryStatement = (TryStatement) node; >- flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits >+ if (!isExceptionOnAutoClose) { >+ if (traversedContext instanceof InsideSubRoutineFlowContext) { >+ ASTNode node = traversedContext.associatedNode; >+ if (node instanceof TryStatement) { >+ TryStatement tryStatement = (TryStatement) node; >+ flowInfo.addInitializationsFrom(tryStatement.subRoutineInits); // collect inits >+ } > } > } > traversedContext = traversedContext.parent; >#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.121 >diff -u -r1.121 NullReferenceTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 12 Aug 2011 20:48:17 -0000 1.121 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 25 Sep 2011 21:30:48 -0000 >@@ -18,6 +18,7 @@ > * bug 336428 - [compiler][null] bogus warning "redundant null check" in condition of do {} while() loop > * bug 324178 - [null] ConditionalExpression.nullStatus(..) doesn't take into account the analysis of condition itself > * bug 354554 - [null] conditional with redundant condition yields weak error message >+ * bug 358827 - [1.7] exception analysis for t-w-r spoils null analysis > *******************************************************************************/ > package org.eclipse.jdt.core.tests.compiler.regression; > >@@ -45,7 +46,7 @@ > // Only the highest compliance level is run; add the VM argument > // -Dcompliance=1.4 (for example) to lower it if needed > static { >-// TESTS_NAMES = new String[] { "testBug348379" }; >+// TESTS_NAMES = new String[] { "test358827" }; > // TESTS_NUMBERS = new int[] { 561 }; > // TESTS_RANGE = new int[] { 1, 2049 }; > } >@@ -14944,4 +14945,31 @@ > "Redundant null check: The variable u cannot be null at this location\n" + > "----------\n"); > } >+// Bug 358827 - [1.7] exception analysis for t-w-r spoils null analysis >+public void test358827() { >+ if (this.complianceLevel >= ClassFileConstants.JDK1_7) { >+ this.runNegativeTest( >+ new String[] { >+ "Bug358827.java", >+ "import java.io.FileReader;\n" + >+ "public class Bug358827 {\n" + >+ " Object foo2() throws Exception {\n" + >+ " String o = null;\n" + >+ " try (FileReader rf = new FileReader(\"file\")){\n" + >+ " o = o.toUpperCase();\n" + >+ " } finally {\n" + >+ " o = \"OK\";\n" + >+ " }\n" + >+ " return o;\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "----------\n" + >+ "1. ERROR in Bug358827.java (at line 6)\n" + >+ " o = o.toUpperCase();\n" + >+ " ^\n" + >+ "Null pointer access: The variable o can only be null at this location\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 358827
:
203976
|
204079
|
204124