Hi,
I looked into this issue and a few things I want to add:
The issue seems to be related to a line number check (createEntry = lineNumber!=line) that is happening in AsmClassGenerator -> onLineNumber(), which writes the ASM label/line number in the bytecode. These line numbers are used in the exception stack trace, as far as I understand.
When the code is written as
var = null
def t = {
var.property = 1 } t()
, the line numbers get written by ASM in the following sequence and since ASM label/line info is being written for "var.property = 1", exception trace is able to show this info.
But when the code is written as:
var = null
def t = { var.property = 1 } t()
, then labels are written as
And now when ACG processes "var.property = 1", it sees the line number as 2, and because of the line check it does not write the line information and hence, we don't see the line number for "var.property = 1" when it results in NPE.
A few small questions:
1) Is there any issue in writing multiple ASM labels/line numbers multiple times for the same source file line?
2) Is there any use of writing line numbers in bytecode for BlockStatement? Do they serve any purpose? [I have no familiarity with ASM or bytecode specification, so this question.]
Thanks,
Roshan
someVariable needs to be defined before it can be used and it has to have the value null if it should cause the NPE. But fact is that the doCall methods shown in the stack trace do not have line numbers in any version