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 188391 Details for
Bug 336428
[compiler][null] bogus warning "redundant null check" in condition of do {} while() loop
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
test & preliminary fix
Bug_336428_v0.patch (text/plain), 2.88 KB, created by
Stephan Herrmann
on 2011-02-05 18:42:45 EST
(
hide
)
Description:
test & preliminary fix
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2011-02-05 18:42:45 EST
Size:
2.88 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 5 Feb 2011 23:30:41 -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 >@@ -524,9 +524,13 @@ > if ((this.tagBits & FlowContext.HIDE_NULL_COMPARISON_WARNING) == 0) { > recordNullReference(local, reference, checkType); > } >- } else if (! flowInfo.cannotBeDefinitelyNullOrNonNull(local)) { >+ } else if (flowInfo.cannotBeDefinitelyNullOrNonNull(local)) { >+ return; // no reason to complain >+ } else { > if (flowInfo.isPotentiallyNonNull(local)) { > recordNullReference(local, reference, CAN_ONLY_NON_NULL | checkType & CONTEXT_MASK); >+ } else if (flowInfo.isPotentiallyNull(local)) { >+ recordNullReference(local, reference, CAN_ONLY_NULL | checkType & CONTEXT_MASK); > } else { > 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.109 >diff -u -r1.109 NullReferenceTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 19 Jan 2011 05:29:57 -0000 1.109 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/NullReferenceTest.java 5 Feb 2011 23:31:00 -0000 >@@ -13832,4 +13832,21 @@ > "}"}, > ""); > } >+// Bug 336428 - [compiler][null] bogus warning "redundant null check" in condition of do {} while() loop >+public void testBug336428() { >+ this.runConformTest( >+ new String[] { >+ "DoWhileBug.java", >+ "public class DoWhileBug {\n" + >+ " void test(boolean b1, Object o1) {\n" + >+ " Object o2 = new Object();\n" + >+ " do {\n" + >+ " if (b1)\n" + >+ " o1 = null;\n" + >+ " } while ((o2 = o1) != 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 336428
:
188390
|
188391
|
189794