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 115392 Details for
Bug 251227
[compiler] Fup of bug 115814, comparing doubles should not be flagged
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix + regression tests
patch_251227.txt (text/plain), 4.05 KB, created by
Olivier Thomann
on 2008-10-17 09:48:06 EDT
(
hide
)
Description:
Proposed fix + regression tests
Filename:
MIME Type:
Creator:
Olivier Thomann
Created:
2008-10-17 09:48:06 EDT
Size:
4.05 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.71 >diff -u -r1.71 EqualExpression.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java 27 Jun 2008 16:03:56 -0000 1.71 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/EqualExpression.java 17 Oct 2008 13:47:34 -0000 >@@ -811,7 +811,9 @@ > > // check whether comparing identical expressions > Binding leftDirect = Expression.getDirectBinding(this.left); >- if (leftDirect != null && leftDirect == Expression.getDirectBinding(this.right)) { >+ if (leftDirect != null && leftDirect == Expression.getDirectBinding(this.right) >+ && this.left.resolvedType != TypeBinding.DOUBLE) { >+ // Double.NaN == Double.NaN => false > scope.problemReporter().comparingIdenticalExpressions(this); > } > return this.resolvedType = TypeBinding.BOOLEAN; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java,v >retrieving revision 1.15 >diff -u -r1.15 ProgrammingProblemsTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 27 Jun 2008 16:04:46 -0000 1.15 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/ProgrammingProblemsTest.java 17 Oct 2008 13:47:35 -0000 >@@ -26,25 +26,25 @@ > public class ProgrammingProblemsTest extends AbstractRegressionTest { > > public ProgrammingProblemsTest(String name) { >- super(name); >+ super(name); > } > > // Static initializer to specify tests subset using TESTS_* static variables >- // All specified tests which does not belong to the class are skipped... >- // Only the highest compliance level is run; add the VM argument >- // -Dcompliance=1.4 (for example) to lower it if needed >- static { >+ // All specified tests which does not belong to the class are skipped... >+ // Only the highest compliance level is run; add the VM argument >+ // -Dcompliance=1.4 (for example) to lower it if needed >+ static { > // TESTS_NAMES = new String[] { "test001" }; >-// TESTS_NUMBERS = new int[] { 1 }; >+// TESTS_NUMBERS = new int[] { 39 }; > // TESTS_RANGE = new int[] { 1, -1 }; >- } >+ } > > public static Test suite() { >- return buildAllCompliancesTestSuite(testClass()); >+ return buildAllCompliancesTestSuite(testClass()); > } > > public static Class testClass() { >- return ProgrammingProblemsTest.class; >+ return ProgrammingProblemsTest.class; > } > > void runTest( >@@ -1399,4 +1399,46 @@ > "Zork cannot be resolved to a type\n" + > "----------\n"); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=251227 >+public void test0038() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportComparingIdentical, CompilerOptions.ERROR); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " double d1 = 0.0;\n" + >+ " System.out.println(d1 == d1);\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "true", >+ null, >+ true, >+ null, >+ options, >+ null); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=251227 >+public void test0039() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_ReportComparingIdentical, CompilerOptions.ERROR); >+ this.runConformTest( >+ new String[] { >+ "X.java", >+ "public class X {\n" + >+ " public static void main(String[] args) {\n" + >+ " double d1 = Double.NaN;\n" + >+ " System.out.println(d1 == d1);\n" + >+ " }\n" + >+ "}\n" >+ }, >+ "false", >+ null, >+ true, >+ null, >+ options, >+ null); >+} > } >\ 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 251227
: 115392