Summary: | Should warn if creating a new Boolean instance | ||
---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Mattias <hibernate> |
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> |
Status: | VERIFIED WONTFIX | QA Contact: | |
Severity: | enhancement | ||
Priority: | P3 | CC: | deepakazad, jarthana, markus.kell.r, Olivier_Thomann |
Version: | 3.6 | ||
Target Milestone: | 3.6 M7 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: |
Description
Mattias
2010-02-02 15:00:39 EST
(In reply to comment #0) > warning should be disabled with a comment such as //$NEW-BOOLEAN$ or with an > annotation such as @SuppressWarnings{"new-boolean"}. Using SuppressWarnings is possible, not the other one. I don't think this would deserve such a special comment. > Constructing new Booleans are almost always a bad idea; their values When this would be a good idea? I don't believe this very special case deserves a specific warning. Markus, what do you think ? I also wouldn't add a warning for that special case. new Boolean(..) is just one instance of the general "use the factory instead of calling the constructor" family of problems. These problems are not general problems that often occur in the Java language, but problems that depend on specific libraries. These kinds of problems don't fit well into our current "Potential programming problems" category. They'd better be implemented in a third=party plug-in for now. Closing as WONTFIX. It is easy using a search request to find all usage of this constructor. It doesn't deserve a specific treatment from the compiler. Verified for 3.6M7. |