Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMF Store] ECollections$EmptyUnmodifiableEList cannot be cast to EStructuralFeature$Setting
icon9.gif  [EMF Store] ECollections$EmptyUnmodifiableEList cannot be cast to EStructuralFeature$Setting [message #1062028] Wed, 05 June 2013 09:32 Go to next message
Laurent Odermatt is currently offline Laurent Odermatt
Messages: 13
Registered: May 2013
Junior Member
Hi,

I'm currently working with a custom metamodel (the models are generated in xml).
When I want to add the EObject which is the root of my model, I get the following
Error : java.lang.ClassCastException: org.eclipse.emf.common.util.ECollections$EmptyUnmodifiableEList cannot be cast to org.eclipse.emf.ecore.EStructuralFeature$Setting 
. (the full error is at the end of the topic).
I encounter this error only when the root contains other objects. When it is empty, I don't have this type of error (I get other errors, but without link with this one).

I think this problem is due to the structure of my model because the "basic" examples (Bowling etc) work fine.

The error appears when I use the "ESLocalProject.getModelElements().add(EObject)" method
Do you have any idea about why I can get this exception?

Cheers,

Laurent


Quote:


!ENTRY org.eclipse.emf.emfstore.common.model 2 2 2013-06-05 15:26:35.217
!MESSAGE EObject Change Observer threw an exception: org.eclipse.emf.emfstore.internal.client.model.impl.OperationManager
!STACK 0
java.lang.ClassCastException: org.eclipse.emf.common.util.ECollections$EmptyUnmodifiableEList cannot be cast to org.eclipse.emf.ecore.EStructuralFeature$Setting
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSetting(BasicEObjectImpl.java:1596)
at org.eclipse.emf.emfstore.internal.common.model.util.ModelUtil.collectOutgoingCrossReferences(ModelUtil.java:1165)
at org.eclipse.emf.emfstore.internal.client.model.impl.OperationRecorder.modelElementAdded(OperationRecorder.java:182)
at org.eclipse.emf.emfstore.internal.client.model.impl.OperationManager.modelElementAdded(OperationManager.java:260)
at org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl$1.run(NotifiableIdEObjectCollectionImpl.java:102)
at org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl$2.run(NotifiableIdEObjectCollectionImpl.java:129)
at org.eclipse.emf.emfstore.common.ESSafeRunner.run(ESSafeRunner.java:36)
at org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl.notifyIdEObjectCollectionChangeObservers(NotifiableIdEObjectCollectionImpl.java:152)
at org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl.modelElementAdded(NotifiableIdEObjectCollectionImpl.java:105)
at org.eclipse.emf.emfstore.internal.common.model.util.EObjectChangeNotifier.addAdapter(EObjectChangeNotifier.java:88)
at org.eclipse.emf.ecore.util.EContentAdapter.handleContainment(EContentAdapter.java:139)
at org.eclipse.emf.ecore.util.EContentAdapter.selfAdapt(EContentAdapter.java:74)
at org.eclipse.emf.ecore.util.EContentAdapter.notifyChanged(EContentAdapter.java:40)
at org.eclipse.emf.emfstore.internal.common.model.util.EObjectChangeNotifier.notifyChanged(EObjectChangeNotifier.java:185)
at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:249)
at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:294)
at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:301)
at org.eclipse.emf.ecp.ui.commands.SpHandler$1.doRun(SpHandler.java:169)
at org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommand.commandBody(EMFStoreCommand.java:50)
at org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:63)
at org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
at org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:69)
at org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:107)
at org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommand.run(EMFStoreCommand.java:59)
at org.eclipse.emf.ecp.ui.commands.SpHandler.runWithCommands(SpHandler.java:171)
at org.eclipse.emf.ecp.ui.commands.SpHandler.runClient(SpHandler.java:142)
at org.eclipse.emf.ecp.ui.commands.SpHandler.execute(SpHandler.java:116)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
at org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
at org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
at org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
at org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.all4tec.sa.core.root.Application.start(Application.java:42)
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:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)


SpHandler is the handler of my plugin.

[Updated on: Wed, 05 June 2013 09:36]

Report message to a moderator

Re: [EMF Store] ECollections$EmptyUnmodifiableEList cannot be cast to EStructuralFeature$Setting [message #1062044 is a reply to message #1062028] Wed, 05 June 2013 10:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
Laurent,

It sounds like you've hand modified the model to have a read-only list.
Have a look at how EClassImpl uses
org.eclipse.emf.ecore.util.EcoreEList.UnmodifiableEList.FastCompare to
do it properly, i.e., multi-valued features must return a list that
implements InternalEList and EStructuralFeature.Setting.


On 05/06/2013 3:32 PM, Laurent Odermatt wrote:
> Hi,
>
> I'm currently working with a custom metamodel (the models are
> generated in xml).
> When I want to add the EObject which is the root of my model, I get
> the following Error : java.lang.ClassCastException:
> org.eclipse.emf.common.util.ECollections$EmptyUnmodifiableEList cannot
> be cast to org.eclipse.emf.ecore.EStructuralFeature$Setting . (the
> full error is at the end of the topic).
> I encounter this error only when the root contains other objects. When
> it is empty, I don't have this type of error (I get other errors, but
> without link with this one).
>
> I think this problem is due to the structure of my model because the
> "basic" examples (Bowling etc) work fine.
>
> Do you have any idea about why I can get this exception?
>
> Cheers,
>
> Laurent
>
>
> Quote:
>> !ENTRY org.eclipse.emf.emfstore.common.model 2 2 2013-06-05 15:26:35.217
>> !MESSAGE EObject Change Observer threw an exception:
>> org.eclipse.emf.emfstore.internal.client.model.impl.OperationManager
>> !STACK 0
>> java.lang.ClassCastException:
>> org.eclipse.emf.common.util.ECollections$EmptyUnmodifiableEList
>> cannot be cast to org.eclipse.emf.ecore.EStructuralFeature$Setting
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSetting(BasicEObjectImpl.java:1596)
>> at
>> org.eclipse.emf.emfstore.internal.common.model.util.ModelUtil.collectOutgoingCrossReferences(ModelUtil.java:1165)
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.OperationRecorder.modelElementAdded(OperationRecorder.java:182)
>> at
>> org.eclipse.emf.emfstore.internal.client.model.impl.OperationManager.modelElementAdded(OperationManager.java:260)
>> at
>> org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl$1.run(NotifiableIdEObjectCollectionImpl.java:102)
>> at
>> org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl$2.run(NotifiableIdEObjectCollectionImpl.java:129)
>> at
>> org.eclipse.emf.emfstore.common.ESSafeRunner.run(ESSafeRunner.java:36)
>> at
>> org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl.notifyIdEObjectCollectionChangeObservers(NotifiableIdEObjectCollectionImpl.java:152)
>> at
>> org.eclipse.emf.emfstore.internal.common.model.impl.NotifiableIdEObjectCollectionImpl.modelElementAdded(NotifiableIdEObjectCollectionImpl.java:105)
>> at
>> org.eclipse.emf.emfstore.internal.common.model.util.EObjectChangeNotifier.addAdapter(EObjectChangeNotifier.java:88)
>> at
>> org.eclipse.emf.ecore.util.EContentAdapter.handleContainment(EContentAdapter.java:139)
>> at
>> org.eclipse.emf.ecore.util.EContentAdapter.selfAdapt(EContentAdapter.java:74)
>> at
>> org.eclipse.emf.ecore.util.EContentAdapter.notifyChanged(EContentAdapter.java:40)
>> at
>> org.eclipse.emf.emfstore.internal.common.model.util.EObjectChangeNotifier.notifyChanged(EObjectChangeNotifier.java:185)
>> at
>> org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:374)
>> at
>> org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:249)
>> at
>> org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:294)
>> at
>> org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:301)
>> at
>> org.eclipse.emf.ecp.ui.commands.SpHandler$1.doRun(SpHandler.java:169)
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommand.commandBody(EMFStoreCommand.java:50)
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.execute(AbstractEMFStoreCommand.java:63)
>> at
>> org.eclipse.emf.common.command.BasicCommandStack.execute(BasicCommandStack.java:78)
>> at
>> org.eclipse.emf.emfstore.internal.client.model.changeTracking.commands.EMFStoreBasicCommandStack.execute(EMFStoreBasicCommandStack.java:69)
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.AbstractEMFStoreCommand.aRun(AbstractEMFStoreCommand.java:107)
>> at
>> org.eclipse.emf.emfstore.internal.client.model.util.EMFStoreCommand.run(EMFStoreCommand.java:59)
>> at
>> org.eclipse.emf.ecp.ui.commands.SpHandler.runWithCommands(SpHandler.java:171)
>> at
>> org.eclipse.emf.ecp.ui.commands.SpHandler.runClient(SpHandler.java:142)
>> at
>> org.eclipse.emf.ecp.ui.commands.SpHandler.execute(SpHandler.java:116)
>> at
>> org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:293)
>> at
>> org.eclipse.core.commands.Command.executeWithChecks(Command.java:476)
>> at
>> org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:508)
>> at
>> org.eclipse.ui.internal.handlers.HandlerService.executeCommand(HandlerService.java:169)
>> at
>> org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
>> at
>> org.eclipse.ui.internal.handlers.SlaveHandlerService.executeCommand(SlaveHandlerService.java:241)
>> at
>> org.eclipse.ui.menus.CommandContributionItem.handleWidgetSelection(CommandContributionItem.java:829)
>> at
>> org.eclipse.ui.menus.CommandContributionItem.access$19(CommandContributionItem.java:815)
>> at
>> org.eclipse.ui.menus.CommandContributionItem$5.handleEvent(CommandContributionItem.java:805)
>> at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
>> at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
>> at
>> org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4165)
>> at
>> org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3754)
>> at
>> org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
>> at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
>> at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
>> at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
>> at
>> org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
>> at
>> org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
>> at
>> org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
>> at com.all4tec.sa.core.root.Application.start(Application.java:42)
>> 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:344)
>> at
>> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
>> at java.lang.reflect.Method.invoke(Unknown Source)
>> at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
>> at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
>> at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
>> at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
>
>
> SpHandler is the handler of my plugin.
Re: [EMF Store] ECollections$EmptyUnmodifiableEList cannot be cast to EStructuralFeature$Setting [message #1062064 is a reply to message #1062044] Wed, 05 June 2013 11:47 Go to previous message
Laurent Odermatt is currently offline Laurent Odermatt
Messages: 13
Registered: May 2013
Junior Member
Ok, thanks.
indeed, several objects' methods return an empty unmodifiable list to forbid modifications on some properties (which are inherited but useless / incoherent on this object).
I'll see with the author of the model to modify this and use a class implementing those.

Cheers,

Laurent
Previous Topic:[EMF Store] ServerInfoImpl is not contained in a resource
Next Topic:Packaging Texo source code into plugin jars
Goto Forum:
  


Current Time: Fri Aug 29 04:20:01 EDT 2014

Powered by FUDForum. Page generated in 0.35047 seconds