Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349199

Summary: Nullpointerexception in console from GmfGen query in FixGMFGen.eol
Product: [Modeling] Epsilon Reporter: Ivar Refsdal <refsdal.ivar>
Component: CoreAssignee: Dimitris Kolovos <dkolovos>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Ivar Refsdal CLA 2011-06-13 10:52:36 EDT
The following steps will reproduce the bug:

Use the model from:
http://www.eclipse.org/gmt/epsilon/doc/eugenia/
i.e.:

@namespace(uri="filesystem", prefix="filesystem")
@gmf(foo="bar")
package filesystem;
 
@gmf.diagram(foo="bar")
class Filesystem {
    val Drive[*] drives;
    val Sync[*] syncs;
}
 
class Drive extends Folder {
 
}
 
class Folder extends File {
    @gmf.compartment(foo="bar")
    val File[*] contents;
}
 
class Shortcut extends File {
    @gmf.link(target.decoration="arrow", style="dash")
    ref File target;
}
 
@gmf.link(source="source", target="target", style="dot", width="2")
class Sync {
    ref File source;
    ref File target;
}
 
@gmf.node(label = "name")
class File {
    attr String name;
}



Put the following in the FixGMFGen.eol file:

var features = GmfGen!FeatureLabelModelFacet.all.select( feat | feat.metaFeatures.isDefined());
var featureLabel = features.selectOne( x | x.metaFeatures.exists( mf | mf.ecoreFeature.name == "name"));
featureLabel.println();

This prints a valid feature, but 
generating the Diagram code now fails with this stacktrace (from the console window of which Eclipse was launched in):

java.lang.NullPointerException
        at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:143)
        at org.eclipse.emf.ecore.util.Diagnostician.validate(Diagnostician.java:114)
        at org.eclipse.gmf.internal.bridge.transform.ValidationHelper.validate(ValidationHelper.java:288)
        at org.eclipse.gmf.internal.bridge.transform.ValidationHelper.validate(ValidationHelper.java:320)
        at org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTemplatesOperation.validateGenModel(ExecuteTemplatesOperation.java:263)
        at org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTemplatesOperation.run(ExecuteTemplatesOperation.java:106)
        at org.eclipse.gmf.internal.codegen.popup.actions.ExecuteTemplatesAction.run(ExecuteTemplatesAction.java:47)
        at org.eclipse.epsilon.eugenia.GenerateDiagramCodeDelegate.runImpl(GenerateDiagramCodeDelegate.java:26)
        at org.eclipse.epsilon.eugenia.GenerateAllDelegate$2.run(GenerateAllDelegate.java:131)
        at org.eclipse.ui.internal.UILockListener.doPendingWork(UILockListener.java:164)
        at org.eclipse.ui.internal.UISynchronizer$3.run(UISynchronizer.java:158)
        at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
        at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
        at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3515)
        at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3164)
        at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
        at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
        at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
        at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
        at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
        at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
        at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
        at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
        at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
        at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:620)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:575)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1408)
        at org.eclipse.equinox.launcher.Main.main(Main.java:1384) 

Bug confirmed and reproduced by Dimitris Kolovos on the epsilon forums.
Comment 1 Dimitris Kolovos CLA 2012-06-26 16:21:38 EDT
Thanks for reporting this and apologies for the very late response. The offending expression appears to be 

mf.ecoreFeature

I can't see how Eugenia/EOL would be responsible for this behaviour so I assume it has something to do with the implementation the GMFGen.