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 158586 Details for
Bug 301405
Warning "Comparing identical expressions" does not take into account that Float.NaN != Float.NaN is true. Same for Double.NaN.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch under consideration
patch.txt (text/plain), 2.57 KB, created by
Srikanth Sankaran
on 2010-02-09 08:09:45 EST
(
hide
)
Description:
Patch under consideration
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-02-09 08:09:45 EST
Size:
2.57 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java,v >retrieving revision 1.77 >diff -u -r1.77 EqualExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java 21 Jan 2010 16:48:36 -0000 1.77 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java 9 Feb 2010 13:07:44 -0000 >@@ -862,7 +862,9 @@ > // check whether comparing identical expressions > Binding leftDirect = Expression.getDirectBinding(this.left); > if (leftDirect != null && leftDirect == Expression.getDirectBinding(this.right)) { >- if (!(this.right instanceof Assignment)) { >+ int leftTypeID = leftType.id; >+ if (leftTypeID != TypeIds.T_JavaLangFloat && leftTypeID != TypeIds.T_JavaLangDouble && // https://bugs.eclipse.org/bugs/show_bug.cgi?id=301405 >+ (!(this.right instanceof Assignment))) { > scope.problemReporter().comparingIdenticalExpressions(this); > } > } >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java,v >retrieving revision 1.65 >diff -u -r1.65 AssignmentTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java 21 Jan 2010 16:48:42 -0000 1.65 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/AssignmentTest.java 9 Feb 2010 13:08:13 -0000 >@@ -1928,6 +1928,34 @@ > options > ); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=301405 >+public void test068() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportComparingIdentical, CompilerOptions.ERROR); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public boolean test(Float f) {\n" + >+ " return f != f;\n" + >+ " }\n" + >+ " public boolean test(Double f) {\n" + >+ " return f != f;\n" + >+ " }\n" + >+ " Zork z;\n" + >+ "}" >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 8)\n" + >+ " Zork z;\n" + >+ " ^^^^\n" + >+ "Zork cannot be resolved to a type\n" + >+ "----------\n", >+ null, >+ true, >+ options >+ ); >+} > public static Class testClass() { > return AssignmentTest.class; > }
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 301405
: 158586