Open rwperrott opened 4 years ago
Yes, that's what I'm actually got set in my pom.xml, it looks like IDEA displayed stale dependency data, for my Maven import, and a re-import fixed that; I may retry debugging later, to verify the 1st issue. My builds were Maven based, so the 2nd issue probably still exists.
Adding to this, using 4.3.1:
Thanks for the report, @rwperrott !!
I don't expect the 2nd issue above to be addressed soon, so investigated more and made a workaround, which I expect to drop later.
ErrorListener
tests if msg is a STRuntimeMessage
and that it's scope field is not null.scope.st.getName().substring(1);
STRuntimeMessage
(in same package, because the interp field was package private), with a modified version of Misc::getLineCharPosition
which starts at the absolute line number, not bogus 1.This hack successfully converts relative line numbers to absolute ones for STGroupFile, including imports, via STGroup::getImportedGroups()
, and should work with STGroupString
too. I suspect that supporting STGroupDir
will be a pain.
I suggest that CompiledST objects should carry an absolute start line number and Misc.getLineCharPosition
sets line
from a start line parameter, not unreliable 1, and that callers, like STRuntimeMessage, are updated to pass in the absolute start line number.
When I try and debug a NullPointerException (!) in ST4-4.0.8.jar, for a 'missing' .st file, the byte-code line number and source jar line numbers don't match, so I have to hunt for the method and guess where inside inside it the exception occurred, which is stupid and annoying, this frustration appears to cover the whole of my stack trace inside the Jar, hmm!
The NullPointerException was caused by the template name being different from the .st filename, but all I got was a very unhelpful NullPointerException because it couldn't find the template name in the templates map in the STGroup class.