I am currently writing templates in SDF3 to enable Pretty Printing and Code Completion.
In an example MiniJava file if I delete everything (or if I make a new file) I get an error message:

" ‘MiniJava ParserScheduler for example.mjv’ has encountered a problem. An internal error occurred during: “MiniJava ParserScheduler for example.mjv”.", with further explanation: java.lang.NullPointerException

If the file contains anything, then nothing happens. I am not sure whether is it my mistake, or an issue with a Spoofax.

Submitted on 9 October 2013 at 03:27

On 9 October 2013 at 10:29 Gabriël Konat commented:

This is most likely a bug in Spoofax. Can you get any more information in the Eclipse error log?


On 9 October 2013 at 11:21 Igor Levaja commented:

No, error log just repeat that, with explanation:

An internal error occurred during: “MiniJava ParserScheduler for example.mjv”.
java.lang.NullPointerException


On 9 October 2013 at 15:37 Guido Wachsmuth commented:

This happens if your grammar does not include any definition of LAYOUT. You can check this in include/<YourLang>.def. If there is no definition of layout, you probably forgot an import.

However, in this case the build should not produce a parse table.


On 9 October 2013 at 16:12 Igor Levaja commented:

I checked include/MiniJava.def and there is a LAYOUT definition in it. Also, parse table is generated as well.


On 9 October 2013 at 17:26 Guido Wachsmuth commented:

Apparently, this is a bug that appears on Windows systems, when you have an empty (or almost empty) file. Paste a complete program into your editor, and it should vanish.


On 9 October 2013 at 17:29 Igor Levaja commented:

Yes, even if there is only one space or a new line, there is no error. And you are right, I am using Eclipse for Windows.


On 9 October 2013 at 17:37 Gabriël Konat tagged error

On 9 October 2013 at 17:37 Gabriël Konat removed tag question

On 9 October 2013 at 17:37 Gabriël Konat tagged lab

On 9 October 2013 at 17:38 Gabriël Konat commented:

May be related to https://yellowgrass.org/issue/Spoofax/697


On 15 October 2013 at 09:53 Gabriël Konat tagged parser

On 16 October 2013 at 14:21 Hendrik van Antwerpen commented:

Can confirm that it’s related to empty files and vanishes once a full program is parsed. It’s not limited to Windows though, I’m running into the issue on Linux as well.


On 16 October 2013 at 14:34 Gabriël Konat commented:

Yes, the NPE is caused by the AST for that editor being null somewhere, because no valid AST has been constructed yet. Once a valid AST has been constructed, it stops producing NPEs.


On 21 October 2013 at 11:11 Guido Wachsmuth commented:

I get this now also on Mac OS. Either we did not recognise this before, because most of our grammars parse empty files, or this was introduced by a recent change. Any ideas?


On 23 October 2013 at 22:53 Guido Wachsmuth commented:

This bug does not occur in stable. It also occurs in nightly, if you use only SDF2 grammars w/o any extra rules generated from SDF3.


On 23 October 2013 at 22:58 Vlad Vergu commented:

It looks like the outline view system needs to defend against a null ast. This is a corresponding stack trace:

	java.lang.NullPointerException
	  at org.strategoxt.imp.runtime.services.views.outline.SpoofaxOutlinePage.update(SpoofaxOutlinePage.java:89)
	  at org.strategoxt.imp.runtime.services.views.outline.SpoofaxOutlinePage.update(SpoofaxOutlinePage.java:72)
	  at org.eclipse.imp.editor.ParserScheduler.notifyModelListeners(ParserScheduler.java:136)
	  at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:95)
	  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

Assigning this to Oskar for now.


On 23 October 2013 at 22:58 Vlad Vergu tagged @oskarvanrest

On 23 October 2013 at 23:48 Oskar van Rest commented:

fixed


On 23 October 2013 at 23:48 Oskar van Rest closed this issue.

Log in to post comments