During building of the Stratego editor, I got the following stracktrace about the outline:

java.lang.NullPointerException
at org.strategoxt.imp.runtime.services.views.outline.SpoofaxOutlinePage.getOutline(SpoofaxOutlinePage.java:285)
at org.strategoxt.imp.runtime.services.views.outline.SpoofaxOutlinePage.access$1(SpoofaxOutlinePage.java:283)
at org.strategoxt.imp.runtime.services.views.outline.SpoofaxOutlinePage$2.run(SpoofaxOutlinePage.java:108)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Submitted by Gabriël Konat on 19 May 2014 at 14:59

On 20 May 2014 at 09:40 Gabriël Konat commented:

This would then happen every subsequent edit, and a workaround is to close and open the file again. Seems very similar to https://yellowgrass.org/issue/Spoofax/856.


On 20 May 2014 at 18:39 Oskar van Rest commented:

I fixed it but we really need some proper Spoofax refactoring to fix it properly and avoid similar issues in the future. Every small change introduces ten new bugs.
https://github.com/metaborg/spoofax/commit/638bcfb9237ac20814f9ed1f6d1035b6fd89bc22


On 20 May 2014 at 18:39 Oskar van Rest closed this issue.

On 20 May 2014 at 18:45 Guido Wachsmuth commented:

Can you sketch what needs to be improved in this refactoring? The code looks like null values need to be handled everywhere and are typically handled by just propagating them.


On 20 May 2014 at 19:29 Oskar van Rest commented:

I think it requires refactoring in the way languages are loaded. Now, during rebuilding of a project, there are various intermediate stages in which only portions of the language are loaded. Instead, a language should first be loaded entirely and should then replace it’s old instance.

There are these two classes called FileState.java and EditorState.java which hold a descriptor. The descriptor holds an IMP language and other things that describe a Spoofax language, like the ESV definition. Now when a language is reloaded, file states, editor states and descriptors are often still hanging around in all kind of classes. However, they don’t provide access to the possibly updated ESV definition and such.

I think once we have our own Language.java and LanguageRegistry.java (not IMP’s ones), we can get rid of editor states, file states and descriptors by moving functionality over to Language.java. Then we have a single point of entry.

Log in to post comments