You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Only in this case:
enum Op {
NE("<>"), // getClass() is "Op$1"
EQ("=") // getClass() is "Op$2"
}
Op.NE.getClass(). isAssignableFrom(Op.EQ.getClass()) // false
Now:
OgnlOps#isEqual(Object, Object) // line 124
is
result = (object1 != null) && (object2 != null)
&& (object1.equals(object2) || (compareWithConversion(object1, object2) == 0));
OgnlOps#compareWithConversion(Object, Object) // line 87 ~ 95
if ((t1 == NONNUMERIC) && (t2 == NONNUMERIC)) {
// **FIXME: when enum is abstract**
if ((v1 instanceof Comparable) && v1.getClass().isAssignableFrom(v2.getClass())) {
result = ((Comparable) v1).compareTo(v2);
break;
} else {
throw new IllegalArgumentException("invalid comparison: " + v1.getClass().getName() + " and "
+ v2.getClass().getName());
}
}
Temporary solution
"Op.NE.name() == 'NE'"
Tip:
before version is ok;
OgnlOps#isEqual(Object, Object)
result = compareWithConversion(object1, object2, true) == 0 || object1.equals(object2);
OgnlOps#compareWithConversion(Object, Object, boolean)
if(!equals) { // **HERE because equals args is true **
throw new IllegalArgumentException("invalid comparison: " + v1.getClass().getName() + " and " + v2.getClass().getName());
}
The text was updated successfully, but these errors were encountered:
OgnlOps#isEqual comparison of two enum thrown IllegalArgumentException
orphan-oss/ognl#15
Only in this case:
enum Op {
NE("<>"), // getClass() is "Op$1"
EQ("=") // getClass() is "Op$2"
}
Op.NE.getClass(). isAssignableFrom(Op.EQ.getClass()) // false
Now:
Temporary solution
"Op.NE.name() == 'NE'"
Tip:
The text was updated successfully, but these errors were encountered: