Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcbateman2009-01-27 22:49:56 +0000
committercbateman2009-01-27 22:49:56 +0000
commite36b956869569f096c03e2595d233e578284dd4f (patch)
treeea7980bc0be898ba58bf7762e2c5854dc270ad8a
parent58d26f2eff6c107d332db56a7505df8957cb4b8f (diff)
downloadwebtools.jsf-e36b956869569f096c03e2595d233e578284dd4f.tar.gz
webtools.jsf-e36b956869569f096c03e2595d233e578284dd4f.tar.xz
webtools.jsf-e36b956869569f096c03e2595d233e578284dd4f.zip
Fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=235637. There was confusion in comparison with null that caused all comparisons with null to be flagged.
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java15
1 files changed, 8 insertions, 7 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
index fcfca0379..dcefc2ee3 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/validation/internal/el/operators/EqualityRelationalBinaryOperator.java
@@ -55,11 +55,12 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
*/
public ValueType performOperation(ValueType firstArg, ValueType secondArg)
{
- // JSP.2.3.5.7 step 2 if either operand is null, then not equal
+ // JSP.2.3.5.7 step 1 if operands are equal, then true for ==, false for !=
if (TypeCoercer.typeIsNull(firstArg.getSignature())
- || TypeCoercer.typeIsNull(secondArg.getSignature()))
+ && TypeCoercer.typeIsNull(secondArg.getSignature()))
{
- return BooleanLiteralType.FALSE;
+ // perform the operation on two arguments that are equal.
+ return BooleanLiteralType.valueOf(doRealOperation(Integer.valueOf(4), Integer.valueOf(4)));
}
String boxedFirstType = TypeTransformer.transformBoxPrimitives(firstArg.getSignature());
@@ -128,7 +129,7 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
}
// otherwise, an equal compare will be done A.equals(B). Since
- return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
+ return new ValueType(TypeConstants.TYPE_BOOLEAN, IAssignable.ASSIGNMENT_TYPE_RHS);
}
private ValueType handleEnumComparison(ValueType firstArg,
@@ -195,10 +196,10 @@ import org.eclipse.jst.jsf.validation.internal.el.diagnostics.DiagnosticFactory;
// JSP.2.3.5.7 step 2 if either operand is null, then not equal
if (TypeCoercer.typeIsNull(firstArg.getSignature())
- || TypeCoercer.typeIsNull(secondArg.getSignature()))
+ && TypeCoercer.typeIsNull(secondArg.getSignature()))
{
- // TODO: this is a strange thing to do...
- final boolean result = doRealOperation(Integer.valueOf(4), null);
+ // perform the operation on two arguments that are equal.
+ final boolean result = doRealOperation(Integer.valueOf(4), Integer.valueOf(4));
return _diagnosticFactory.create_BINARY_OP_EQUALITY_COMP_WITH_NULL_ALWAYS_EVAL_SAME(Boolean.toString(result));
}

Back to the top