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 174558 Details for
Bug 320170
[compiler] [null] Whitebox issues in null analysis
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
proposed patch
Bug_320170.patch (text/plain), 3.24 KB, created by
Stephan Herrmann
on 2010-07-17 11:28:08 EDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2010-07-17 11:28:08 EDT
Size:
3.24 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java,v >retrieving revision 1.10 >diff -u -r1.10 NullInfoRegistry.java >--- compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java 7 Mar 2009 01:08:10 -0000 1.10 >+++ compiler/org/eclipse/jdt/internal/compiler/flow/NullInfoRegistry.java 17 Jul 2010 15:24:31 -0000 >@@ -319,7 +319,7 @@ > // prot. non null > & ((a2 = this.nullBit2) | (a4 = this.nullBit4)); > // null or unknown >- m2 = s1 & (s2 = this.nullBit2) & (s3 ^ s4) >+ m2 = s1 & (s2 = this.nullBit2) & (s3 ^ s4) // TODO(stephan): potential typo: should this be "s2 = source.nullBit2"??? > // prot. null > & ((a3 = this.nullBit3) | a4); > // non null or unknown >@@ -330,12 +330,19 @@ > | (ns2 = ~s2) & s3 & ns4 & (a2 | a4) > | ns2 & ns3 & s4 & (a2 | a3)); > if ((m = (m1 | m2 | m3)) != 0) { >+ long x = ~this.nullBit1 & a2 & a3 & a4; > newCopy = true; > source = source.unconditionalCopy(); > source.nullBit1 &= ~m; > source.nullBit2 &= (nm1 = ~m1) & ((nm2 = ~m2) | a4); > source.nullBit3 &= (nm1 | a2) & nm2; > source.nullBit4 &= nm1 & nm2; >+ if (x != 0) { >+ source.nullBit1 &= ~x; >+ source.nullBit2 |= x; >+ source.nullBit3 |= x; >+ source.nullBit4 |= x; >+ } > } > if (this.extra != null && source.extra != null) { > int length = this.extra[2].length, sourceLength = source.extra[0].length; >#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.95 >diff -u -r1.95 NullReferenceTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 16 Mar 2010 14:36:08 -0000 1.95 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 17 Jul 2010 15:24:46 -0000 >@@ -5484,6 +5484,35 @@ > ""); > } > >+//null analysis -- try/finally >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=320170 - [compiler] [null] Whitebox issues in null analysis >+//trigger nullbits 0111 (pot n|nn|un), don't let "definitely unknown" override previous information >+public void test0536_try_finally() { >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " X bar () { return null; }\n" + >+ " void foo() {\n" + >+ " X x = new X();\n" + >+ " try {\n" + >+ " x = null;\n" + >+ " x = new X();\n" + // if this throws an exception finally finds x==null >+ " x = bar();\n" + >+ " } finally {\n" + >+ " x.toString();\n" + // complain >+ " }\n" + >+ " }\n" + >+ "}\n"}, >+ "----------\n" + >+ "1. ERROR in X.java (at line 10)\n" + >+ " x.toString();\n" + >+ " ^\n" + >+ "Potential null pointer access: The variable x may be null at this location\n" + >+ "----------\n", >+ JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); >+} >+ > // null analysis -- try/catch > public void test0550_try_catch() { > this.runConformTest(
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 320170
:
174558
|
174767
|
175498