NPE with Sunshine, but possibly JSGLR issue
When using Sunshine to parse the following Entity instance (it ends with a single empty line, but YellowGrass doesn’t show that):
module example entity URL { }a
I get this error:
java.lang.NullPointerException 09:58:56.912 [main] FATAL org.metaborg.sunshine.CompilerCrashHandler - Exiting because of previous error at org.metaborg.sunshine.model.messages.CodeRegionHelper.weaveDamageLines(CodeRegionHelper.java:30) at org.metaborg.sunshine.model.messages.CodeRegion.getDamagedRegion(CodeRegion.java:119) at org.metaborg.sunshine.model.messages.Message.toString(Message.java:91) at java.lang.String.valueOf(String.java:2854) at java.lang.StringBuilder.append(StringBuilder.java:128) at org.metaborg.sunshine.model.messages.MessageEmitter.emitMessages(MessageEmitter.java:20) at org.metaborg.sunshine.drivers.SunshineMainDriver.run(SunshineMainDriver.java:201) at org.metaborg.sunshine.drivers.Main.main(Main.java:50)
I also had similar cases where the error is at the end of the line, but not necessarily at the end of the file.
I tried to debug it by adding print statements to
reportErrorNearOffset(..)
:private void reportErrorNearOffset(ITokenizer tokenizer, int offset, String message) { IToken errorToken = tokenizer.getErrorTokenOrAdjunct(offset); System.out.println(offset + errorToken); reportErrorAtTokens(errorToken, errorToken, message); }
For the Entity instance, this prints
Submitted by Oskar van Rest on 13 August 2014 at 19:2830
but I would expect29a
or30a
(not sure how to count the tokens).
This suggests that it is an issue with JSGLR. However, the Eclipse editor does report the errors correctly.
Perhaps there a hack is provided in Spoofax Eclipse to workaround the JSGLR issue? Or perhaps this is not an issue with JSGLR but an issue with Sunshine?
Log in to post comments