Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [ECP] Two Implementations Avoids IllegalArgumentException: The class ... is not a valid classifier(Is this a bug or expected behavior?)
[ECP] Two Implementations Avoids IllegalArgumentException: The class ... is not a valid classifier [message #1744335] Mon, 26 September 2016 01:16 Go to next message
Jon Passki is currently offline Jon PasskiFriend
Messages: 31
Registered: November 2015
Member

Is the below a bug or expected behavior in ECP 1.9.0 (on Neon)?

Given the following:

  • When an EClass (e.g. UserGroup) has an EReference to some other EClass (e.g. Foo);
  • When that referred to EClass (e.g. Foo) is also an interface
  • And there is only one EClass (e.g. FooOne) that uses the referred EClass as its ESuperType

The exception java.lang.IllegalArgumentException below occurs in ECP when clicking on the green plus button to create and link a new instance of the referred EClass.

The exception can be avoided by creating another EClass (e.g. FooTwo) that also uses the referred EClass as its ESuperType. When clicking the link + green plus button, a "New Reference Element" window pops up with both implementations selectable.

Steps to reproduce first part:

  1. Modify the Make It Happen example task.ecore model:

    1. Add a new EClass "Foo" to the tasks package; set its Interface property to true; add an EReference to UserGroup
    2. Add a new EClass "FooOne" also on tasks; set its ESuperType to "Foo"
    3. Add a new EReference to "UserGroup" that points to "Foo"; set its EOpposite to "userGroup"

  2. Save, Reload..., Generate Model Code, Generate Edit Code
  3. Launch the org.eclipse.emf.ecp.application.e4.product
  4. Create a new ECP Project, insert a new model element of UserGroup, and click on "Create and link new Foo". This should case an exception.

Steps to reproduce second part:

  1. Modify the Make It Happen example task.ecore model again:

    1. Add a new EClass "FooTwo" also on tasks; set its ESuperType to "Foo"

  2. Save, Reload..., Generate Model Code, Generate Edit Code
  3. Launch the org.eclipse.emf.ecp.application.e4.product
  4. Create a new ECP Project, insert a new model element of UserGroup, and click on "Create and link new Foo". This should work as normal.


!STACK 0
java.lang.IllegalArgumentException: The class 'Foo' is not a valid classifier
  at org.eclipse.emf.ecp.makeithappen.model.task.impl.TaskFactoryImpl.create(TaskFactoryImpl.java:90)
  at org.eclipse.emf.ecp.spi.ui.ECPReferenceServiceImpl.addNewModelElements(ECPReferenceServiceImpl.java:105)
  at org.eclipse.emf.ecp.view.internal.core.swt.renderer.LinkControlSWTRenderer$7.widgetSelected(LinkControlSWTRenderer.java:263)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:249)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4248)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1501)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1524)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1509)
  at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1313)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4072)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3698)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1121)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1022)
  at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:150)
  at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:161)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:498)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:673)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:610)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1519)
  at org.eclipse.equinox.launcher.Main.main(Main.java:1492)
Re: [ECP] Two Implementations Avoids IllegalArgumentException: The class ... is not a valid classifi [message #1744474 is a reply to message #1744335] Tue, 27 September 2016 11:00 Go to previous message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 147
Registered: May 2015
Senior Member
Hi Jon,
this is definitively a Bug. Could you please open a Bug for this.
If there is only one Instance of an interface or abstract class it should simply take this and do nothing. This seems to be broken.

In the mean time you will need to provide your own ReferenceService implementation (as an OSGi service).

Thank you for the report.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:[Edapt] Edapt validation for earlier releases
Next Topic:Performance issue after EMF complex tree creation?
Goto Forum:
  


Current Time: Wed Nov 14 17:12:03 GMT 2018

Powered by FUDForum. Page generated in 0.02206 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top