Community
Participate
Working Groups
On one of our Xtext-based editors, we found an NPE every time we open a file that contains a particular sequence of text that does not conform with the grammar. The same happens when typing the same text in an empty file. Here is a sample of the stack trace: java.lang.NullPointerException at org.eclipse.xtext.EcoreUtil2.getContainerOfType(EcoreUtil2.java:100) at org.eclipse.xtext.GrammarUtil.containingAssignment(GrammarUtil.java:95) I fixed this temporarily by overriding the default ILocationInFileProvider in the runtime Guice module. I pretty much extended DefaultLocationInFileProvider and overrode findNodeFor(EObject) adding checks for null. It would be great if containingAssignment or getContainerOfType check for null EObjects. Thanks, -Alex
Has been already fixed some days ago git.eclipse.org/c/tmf/org.eclipse.xtext.git/commit/?id=5b5eeedcd55f9fdb78c9eef19f3e0c77a35af52e
That getContainerOfType() refactoring actually contained an accidental change of contract. But I don't see any problem with returning 'null' on 'null' input. Does anyone disagree?