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 152308 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
Contains test case
Bugs.txt (text/plain), 1.05 KB, created by
Dietmar Hechensteiner
on 2009-11-16 10:15:44 EST
(
hide
)
Description:
Contains test case
Filename:
MIME Type:
Creator:
Dietmar Hechensteiner
Created:
2009-11-16 10:15:44 EST
Size:
1.05 KB
patch
obsolete
> >package test; >import java.net.MalformedURLException; >import java.net.URL; > >public class Main { > > public static void main(String[] args) { > test1(args); > test2(args); > test3(args); > } > > private static void test1(String[] args) { > URL[] urls = null; > try { > urls = new URL[args.length]; > for (int i = 0; i < args.length; i++) > urls[i] = new URL("http", "", -1, args[i]); > } > catch (MalformedURLException mfex) { > urls = null; // Wrong warning here: 'The variable urls can only be null at this location'. > } > } > > private static void test2(String[] args) { > assert args != null; > if (args != null) { // Wrong warning here: 'The variable args cannot be null at this location'. > // do something > } > } > > private static void test3(String[] args) { > while (true) { > Object a = null; > try { > a = new Object(); > } catch (Exception e) { > } finally { > if (a != null) > a = null; // Wrong warning here: 'Null comparison always yields false: The variable a cannot be null at this location'. > } > } > } >}
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 Raw
Actions:
View
Attachments on
bug 295260
: 152308 |
152575