Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.5
-
None
Description
Do a javap -l on the following code:
class Runner { public void printit() { x("III") x("III") } }
and the printit method will look something like this:
public void printit(); LineNumberTable: line 2: 4 line 3: 4 line 4: 17 LocalVariableTable: Start Length Slot Name Signature 0 31 0 this LRunner;
Notice that the LineNumberTable has 3 entries, but the original method has only 2 instruction lines of code. The first, rogue line number corresponds to the method's block statement.
The problem is that there are 2 entries corresponding to the #4 instruction. This occasionally confuses the debugger when it is trying to install the breakpoint on a running app (ie- sometimes it works and sometimes it does not).
I tracked the problem down to AsmClassGenerator.visitBlockStatement(), which calls the onLineNumber method and (incorrectly, it seems) adds a line number entry for the start of the block statement. Simply commenting this line out (line 721 on version 1.7.5) appears to work for me.
Is there any reason why we should not go ahead with the fix?