Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeException in Democles when changing target model of TGG #93

Open
SvenPeldszus opened this issue Aug 13, 2019 · 0 comments
Open
Labels

Comments

@SvenPeldszus
Copy link
Collaborator

I am getting RuntimeException when performing changes on the target model of my TGG.

For sure this happens when the change has an influence on the containment hierarchy of model elements - e.g. I change the container of an element.

Below is the RuntimeException for another case:

java.lang.RuntimeException
    at org.gervarro.democles.incremental.emf.NotificationCollector.handleReferenceAddition(NotificationCollector.java:424)
    at org.gervarro.democles.incremental.emf.NotificationCollector.notifyChanged(NotificationCollector.java:214)
    at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424)
    at org.eclipse.emf.ecore.util.EcoreEList.dispatchNotification(EcoreEList.java:249)
    at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:356)
    at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:340)
    at org.gravity.security.annotations.SecurityAnnotationsProcessorFwd.replace(SecurityAnnotationsProcessorFwd.java:83)
    at org.gravity.security.annotations.SecurityAnnotationsProcessorFwd.process(SecurityAnnotationsProcessorFwd.java:48)
    at org.gravity.tgg.modisco.MoDiscoTGGConverter.convertProject(MoDiscoTGGConverter.java:147)
    at org.gravity.tgg.modisco.MoDiscoTGGConverter.convertProject(MoDiscoTGGConverter.java:80)
    at org.gravity.tgg.test.complete.pm.ProgramModelTest.testForward(ProgramModelTest.java:77)
    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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
    at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.lang.Thread.run(Thread.java:748)

In this case I was executing the following code:

private void replace(TAnnotation tAnnotation, TAnnotation replacement) {
	EcoreUtil.replace(tAnnotation, replacement);
	for(Setting setting : EcoreUtil.UsageCrossReferencer.find(tAnnotation, rs)) {
		if (setting instanceof EList) {
			@SuppressWarnings("unchecked") 
			EList<TAnnotation> list = (EList<TAnnotation>) setting;
			int index = list.indexOf(tAnnotation);
			list.remove(index);
			list.add(index, replacement);
		}
		else {
			EObject eObject = setting.getEObject();
			eObject.eSet(setting.getEStructuralFeature(), replacement);
		}
	}
}

The error appears when the following statement is executed: list.add(index, replacement);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant