### 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; }