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

Having the same property association as a contained property association and direct association causes instantiation exception #2259

Closed
AaronGreenhouse opened this issue Mar 27, 2020 · 1 comment · Fixed by #2261

Comments

@AaronGreenhouse
Copy link
Contributor

@AaronGreenhouse AaronGreenhouse commented Mar 27, 2020

Discovered this when I accidentally made the same property association to bind a connection to bus twice:

  1. As a direct property association on the connection declaration
  2. As a contained property association on the whole system.
package Broken
public
	with SEI;

	-- Some basics
	
	data D8
		properties
			Data_Size => 8 Bytes;
	end D8;
	
	-- buses
	
	bus MyBus
	end MyBus;
	
	system S1
		features
			out1: out data port D8;
	end S1;

	system S2
		features
			in1: in data port D8;
	end S2;

	-- assembled system
	
	system top
	end top;
	
	system implementation top.i
		subcomponents
			sub1: system s1;
			sub2: system s2;
			theBus: bus MyBus;
		connections
			conn1: port sub1.out1 -> sub2.in1 {
				Actual_Connection_Binding => (reference (theBus));
			};
		properties
			-- Bind the connections
			Actual_Connection_Binding => (reference (theBus)) applies to conn1;		
	end top.i;
end Broken;

When you instantiate the system instance top.i you get an exception:

java.util.ConcurrentModificationException
	at org.eclipse.emf.common.util.AbstractEList$EIterator.checkModCount(AbstractEList.java:751)
	at org.eclipse.emf.common.util.AbstractEList$EIterator.doNext(AbstractEList.java:699)
	at org.eclipse.emf.common.util.AbstractEList$EIterator.next(AbstractEList.java:685)
	at org.osate.aadl2.instantiation.CachePropertyAssociationsSwitch.cacheConnectionPropertyAssociations(CachePropertyAssociationsSwitch.java:265)
	at org.osate.aadl2.instantiation.CachePropertyAssociationsSwitch$1.caseConnectionInstance(CachePropertyAssociationsSwitch.java:123)
	at org.osate.aadl2.instantiation.CachePropertyAssociationsSwitch$1.caseConnectionInstance(CachePropertyAssociationsSwitch.java:1)
	at org.osate.aadl2.instance.util.InstanceSwitch.doSwitch(InstanceSwitch.java:193)
	at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:53)
	at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:69)
	at org.osate.aadl2.modelsupport.modeltraversal.AadlProcessingSwitch.process(AadlProcessingSwitch.java:159)
	at org.osate.aadl2.modelsupport.modeltraversal.ForAllElement.processObject(ForAllElement.java:278)
	at org.osate.aadl2.modelsupport.modeltraversal.PreOrderTraversal.visitRoot(PreOrderTraversal.java:42)
	at org.osate.aadl2.modelsupport.modeltraversal.PreOrderTraversal.visitRoot(PreOrderTraversal.java:47)
	at org.osate.aadl2.modelsupport.modeltraversal.ForAllElement.processPreOrderAll(ForAllElement.java:545)
	at org.osate.aadl2.instantiation.InstantiateModel.getUsedPropertyDefinitions(InstantiateModel.java:543)
	at org.osate.aadl2.instantiation.InstantiateModel.fillSystemInstance(InstantiateModel.java:488)
	at org.osate.aadl2.instantiation.InstantiateModel.createSystemInstanceInt(InstantiateModel.java:418)
	at org.osate.aadl2.instantiation.InstantiateModel.createSystemInstance(InstantiateModel.java:371)
	at org.osate.aadl2.instantiation.InstantiateModel.buildInstanceModelFile(InstantiateModel.java:237)
	at org.osate.ui.handlers.InstantiationHandler$InstantiationJob.runInWorkspace(InstantiationHandler.java:243)
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Now obviously this model is broken, but it should not result in a Java exception

@lwrage lwrage self-assigned this Mar 30, 2020
@lwrage lwrage added this to the 2.7.1 milestone Mar 30, 2020
lwrage added a commit that referenced this issue Mar 30, 2020
@lwrage
Copy link
Contributor

@lwrage lwrage commented Mar 30, 2020

Fixing this shows another bug: now the binding is duplicated in the instance model.

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

Successfully merging a pull request may close this issue.

2 participants