Janino

Janino issues "Error: For update is unreachable" where JAVAC keeps compiling

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Number of attachments :
    0

Description

Arno

I have created a bunch of test cases related to loop
processing in Janino. I also created a patch that
seems to fix all the loop related bugs that I was
running into. The patch and test files can be
found here:

http://www.modejong.com/tcljava/janino/

This patch fixes almost every case where Janino
was incorrectly generating an error in my code.

Activity

Hide
Arno Unkrig added a comment -

Thank you for the HUGE bunch of test cases. I agree with you: The FOR updates are definitely unreachable (so JANINO is right to issue an error), but JAVAC just kicks them out. I believe it is not a good idea to silently ignore code that the programmer has written, because this almost certainly a programming error.

I changed Janino's behavior such that it ignores the unreachable update, but issues a warning (use "-warn:*" to turn warnings on).

I checked the patch that you proposed, but found a much simpler solution for JANINO-54:

UnitCompiler.java
// Yes, compile rest of method to /dev/null.
throw UnitCompiler.STOP_COMPILING_CODE;

No more "keepCompiling" and "followingStatementsAreDead".

Show
Arno Unkrig added a comment - Thank you for the HUGE bunch of test cases. I agree with you: The FOR updates are definitely unreachable (so JANINO is right to issue an error), but JAVAC just kicks them out. I believe it is not a good idea to silently ignore code that the programmer has written, because this almost certainly a programming error. I changed Janino's behavior such that it ignores the unreachable update, but issues a warning (use "-warn:*" to turn warnings on). I checked the patch that you proposed, but found a much simpler solution for JANINO-54:
UnitCompiler.java
// Yes, compile rest of method to /dev/null.
throw UnitCompiler.STOP_COMPILING_CODE;
No more "keepCompiling" and "followingStatementsAreDead".
Hide
Arno Unkrig added a comment -

Fix release in 2.4.3.

Show
Arno Unkrig added a comment - Fix release in 2.4.3.
Hide
Arno Unkrig added a comment -

Fix will be released in version 2.4.4 (not scheduled yet).

Show
Arno Unkrig added a comment - Fix will be released in version 2.4.4 (not scheduled yet).

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: