janino-compiler/janino

Bad case in Basic example

Joey777210 opened this issue · 4 comments

Hi, I'm new to janino, and try to get some example on homepage. But there is a ambiguous reference of the first example:
image

Run that code on JDK1.8, it gives ambiguous reference.
This can be a bad guide for beginners, maybe replace with another case?

See this two functions:
image

And also, how can I use evaluate on pure int type expression?

That example code doesn't work since Janino 3.0.16, when I changed the signature of

org.codehaus.commons.compiler.IExpressionEvaluator.evaluate(int idx, @Nullable Object[] arguments)

to

org.codehaus.commons.compiler.IExpressionEvaluator.evaluate(int idx, @Nullable Object... arguments)

, assuming that this is a compatible API change. (As you proved, it is not.)

Because it is not easily possible to revert that API change without breaking application code, I fixed the code example instead.

Thank you for reporting the problem! Please re-test.

That looks fine, Thanks.