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 188605 Details for
Bug 313870
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 v1.0 + regression tests
patch331138.txt (text/plain), 4.57 KB, created by
Ayushman Jain
on 2011-02-09 12:30:10 EST
(
hide
)
Description:
proposed fix v1.0 + regression tests
Filename:
MIME Type:
Creator:
Ayushman Jain
Created:
2011-02-09 12:30:10 EST
Size:
4.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java,v >retrieving revision 1.51 >diff -u -r1.51 LoopingFlowContext.java >--- compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java 23 Aug 2010 08:41:25 -0000 1.51 >+++ compiler/org/eclipse/jdt/internal/compiler/flow/LoopingFlowContext.java 9 Feb 2011 17:26:22 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 2011 IBM Corporation and others. > * All rights reserved. This program and the accompanying materials > * are made available under the terms of the Eclipse Public License v1.0 > * which accompanies this distribution, and is available at >@@ -519,7 +519,7 @@ > flowInfo.initsWhenTrue().setReachMode(FlowInfo.UNREACHABLE); > } > } >- } else if (this.upstreamNullFlowInfo.isDefinitelyNonNull(local) && !flowInfo.isPotentiallyNull(local)) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=291418 >+ } else if (this.upstreamNullFlowInfo.isDefinitelyNonNull(local) && !flowInfo.isPotentiallyNull(local) && !flowInfo.isPotentiallyUnknown(local)) { // https://bugs.eclipse.org/bugs/show_bug.cgi?id=291418 > flowInfo.markAsDefinitelyNonNull(local); > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { > recordNullReference(local, reference, checkType); >#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.111 >diff -u -r1.111 NullReferenceTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 8 Feb 2011 05:59:20 -0000 1.111 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 9 Feb 2011 17:26:29 -0000 >@@ -13947,4 +13947,82 @@ > }, > "SUCCESS"); > } >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=313870 >+public void testBug313870() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " String s = \"\";\n" + >+ " for (int i = 0; i < 2; i++) {\n" + >+ " if (i != 0) { \n" + >+ " s = test();\n" + >+ " }\n" + >+ " if (s == null) {\n" + >+ " System.out.println(\"null\");\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ " public static String test() {\n" + >+ " return null;\n" + >+ " }\n" + >+ "}" >+ }, >+ "null"); >+} >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=313870 >+public void testBug313870b() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.io.BufferedReader;\n" + >+ "import java.io.IOException;\n" + >+ "public class X {\n" + >+ " public void main(BufferedReader bufReader) throws IOException {\n" + >+ " String line = \"\";\n" + >+ " boolean doRead = false;\n" + >+ " while (true) {\n" + >+ " if (doRead) { \n" + >+ " line = bufReader.readLine();\n" + >+ " }\n" + >+ " if (line == null) {\n" + >+ " return;\n" + >+ " }\n" + >+ " doRead = true;\n" + >+ " }\n" + >+ " }\n" + >+ "}" >+ }, >+ ""); >+} >+ >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=313870 >+public void testBug313870c() { >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "import java.io.File;\n" + >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " boolean sometimes = (System.currentTimeMillis() & 1L) != 0L;\n" + >+ " File file = new File(\"myfile\");\n" + >+ " for (int i = 0; i < 2; i++) {\n" + >+ " if (sometimes) { \n" + >+ " file = getNewFile();\n" + >+ " }\n" + >+ " if (file == null) { \n" + >+ " System.out.println(\"\");\n" + >+ " }\n" + >+ " }\n" + >+ " }\n" + >+ " private static File getNewFile() {\n" + >+ " return null;\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 313870
:
169480
|
188566
| 188605