diff --git a/src/asciidoc/core-expressions.adoc b/src/asciidoc/core-expressions.adoc index 3052d3d969..7bdca9b793 100644 --- a/src/asciidoc/core-expressions.adoc +++ b/src/asciidoc/core-expressions.adoc @@ -785,7 +785,7 @@ expression based `matches` operator. ---- // evaluates to false boolean falseValue = parser.parseExpression( - "'xyz' instanceof T(int)").getValue(Boolean.class); + "'xyz' instanceof T(Integer.class)").getValue(Boolean.class); // evaluates to true boolean trueValue = parser.parseExpression( @@ -796,6 +796,13 @@ expression based `matches` operator. "'5.0067' matches '\^-?\\d+(\\.\\d{2})?$'").getValue(Boolean.class); ---- +[NOTE] +==== +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)` +evaluates to `true`, as expected. +==== + Each symbolic operator can also be specified as a purely alphabetic equivalent. This avoids problems where the symbols used have special meaning for the document type in which the expression is embedded (eg. an XML document). The textual equivalents are