Fix class literal in instanceof
Closes gh-1151
This commit is contained in:
committed by
Stephane Nicoll
parent
76ed101a23
commit
dc3f62d576
@@ -785,7 +785,7 @@ expression based `matches` operator.
|
|||||||
----
|
----
|
||||||
// evaluates to false
|
// evaluates to false
|
||||||
boolean falseValue = parser.parseExpression(
|
boolean falseValue = parser.parseExpression(
|
||||||
"'xyz' instanceof T(Integer.class)").getValue(Boolean.class);
|
"'xyz' instanceof T(Integer)").getValue(Boolean.class);
|
||||||
|
|
||||||
// evaluates to true
|
// evaluates to true
|
||||||
boolean trueValue = parser.parseExpression(
|
boolean trueValue = parser.parseExpression(
|
||||||
@@ -799,7 +799,7 @@ expression based `matches` operator.
|
|||||||
[NOTE]
|
[NOTE]
|
||||||
====
|
====
|
||||||
Be careful with primitive types as they are immediately boxed up to the wrapper type,
|
Be careful with primitive types as they are immediately boxed up to the wrapper type,
|
||||||
so `1 instanceof T(int)` evaluates to `false` while `1 instanceof T(Integer.class)`
|
so `1 instanceof T(int)` evaluates to `false` while `1 instanceof T(Integer)`
|
||||||
evaluates to `true`, as expected.
|
evaluates to `true`, as expected.
|
||||||
====
|
====
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user