Community
Participate
Working Groups
// 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);
}
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" +
" Zork z;\n" +
"}"
},
"----------\n" +
"1. ERROR in X.java (at line 8)\n" +
" ^^^^\n" +
"Zork cannot be resolved to a type\n" +
"----------\n",
null,
true,
public static Class testClass() {
return AssignmentTest.class;