konsoletyper/teavm-flavour

instanceof causes compile-time error in ExprPlanEmitter.java:538

ScraM-Team opened this issue · 2 comments

I have not been successful with the instanceof operator in a template expression. It is listed as supported in the documentation here: http://teavm.org/docs/flavour/expression-language.html

When I include this EL in a template:

<std:if condition="this instanceof Object">
  This is an Object!
</std:if>

I get this compile-time error:

[INFO] Building JavaScript file
[INFO] Output file built with errors
[ERROR] Wrong call to org.teavm.metaprogramming.ReflectClass.isInstance(Ljava/lang/Object;)Z method 
    at org.teavm.flavour.templates.Templates.create(ExprPlanEmitter.java:538)

I have tried other objects and importing java.lang.Object, without success.

Thanks for the fix! I will try this tomorrow, that's going to make my templates cleaner.

It worked, thank you @konsoletyper !!!