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

Fixed data access connections to subprograms #2179

Merged
merged 7 commits into from Jan 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1,18 +1,18 @@
/**
* Copyright (c) 2004-2020 Carnegie Mellon University and others. (see Contributors file).
* Copyright (c) 2004-2020 Carnegie Mellon University and others. (see Contributors file).
* All Rights Reserved.
*
*
* NO WARRANTY. ALL MATERIAL IS FURNISHED ON AN "AS-IS" BASIS. CARNEGIE MELLON UNIVERSITY MAKES NO WARRANTIES OF ANY
* KIND, EITHER EXPRESSED OR IMPLIED, AS TO ANY MATTER INCLUDING, BUT NOT LIMITED TO, WARRANTY OF FITNESS FOR PURPOSE
* OR MERCHANTABILITY, EXCLUSIVITY, OR RESULTS OBTAINED FROM USE OF THE MATERIAL. CARNEGIE MELLON UNIVERSITY DOES NOT
* MAKE ANY WARRANTY OF ANY KIND WITH RESPECT TO FREEDOM FROM PATENT, TRADEMARK, OR COPYRIGHT INFRINGEMENT.
*
*
* This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
* SPDX-License-Identifier: EPL-2.0
*
*
* Created, in part, with funding and support from the United States Government. (see Acknowledgments file).
*
*
* This program includes and/or can make use of certain third party source code, object code, documentation and other
* files ("Third Party Software"). The Third Party Software that is used by this program is dependent upon your system
* configuration. By using this program, You agree to comply with any and all relevant Third Party Software terms and
Expand Down Expand Up @@ -80,8 +80,8 @@
import org.osate.aadl2.Property;
import org.osate.aadl2.PropertyExpression;
import org.osate.aadl2.Subcomponent;
import org.osate.aadl2.SubprogramCall;
import org.osate.aadl2.SubprogramSubcomponent;
import org.osate.aadl2.SubprogramType;
import org.osate.aadl2.TriggerPort;
import org.osate.aadl2.impl.ParameterImpl;
import org.osate.aadl2.instance.ComponentInstance;
Expand Down Expand Up @@ -391,10 +391,11 @@ private void appendSegment(ConnectionInfo connInfo, final Connection newSegment,
}

/*
* Fix JD bug #222
* Fix JD bug #222.
* Tweaked again for Issue #2162: changed to check if the context is a subprogram call
* rather than just checking if the feature is contained in a subprogram.
*/
if ((toEnd instanceof DataAccess) && (toEnd.getContainingClassifier() != null)
&& (toEnd.getContainingClassifier() instanceof SubprogramType)) {
if ((toEnd instanceof DataAccess) && (toCtx instanceof SubprogramCall)) {
return;
}

Expand Down
2 changes: 2 additions & 0 deletions core/org.osate.core.tests/models/Issue2161/.gitignore
@@ -0,0 +1,2 @@
/.aadlbin-gen/
/instances/
18 changes: 18 additions & 0 deletions core/org.osate.core.tests/models/Issue2161/.project
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Issue2161</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.osate.core.aadlnature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
</natures>
</projectDescription>
@@ -0,0 +1,62 @@
package DataAccessConnectionTest
public
data Shared
end Shared;

data implementation Shared.impl
end Shared.impl;

subprogram RequiresData
features
shared: requires data access Shared;
end RequiresData;

subprogram implementation RequiresData.impl
end RequiresData.impl;

thread ThreadRequiresData
features
shared: requires data access Shared;
end ThreadRequiresData;

thread implementation ThreadRequiresData.impl
subcomponents
sp: subprogram RequiresData.impl;
calls main: {
s1 : subprogram sp;
};
connections
dc: data access shared -> sp.shared;
end ThreadRequiresData.impl;

process Proc
features
externalData: requires data access;
end Proc;

process implementation Proc.impl
subcomponents
shared: data Shared.impl;
t1: thread ThreadRequiresData.impl;
connections
s1: data access shared <-> t1.shared;
end Proc.impl;

processor P
end P;

processor implementation P.impl
end P.impl;

system DACT
end DACT;

system implementation DACT.impl
subcomponents
proc: processor P.impl;
app: process Proc.impl;
properties
Actual_Processor_Binding => (reference (proc)) applies to app;
end DACT.impl;

end DataAccessConnectionTest;
@@ -0,0 +1,65 @@
package SharedData_to_Data_Nested_in_Data
public
data ShareMe
end ShareMe;

data InnerD
features
daf1: requires data access ShareMe;
end InnerD;

data OuterD
features
daf2: requires data access ShareMe;
end OuterD;

data implementation OuterD.generic
subcomponents
inner: data InnerD;
end OuterD.generic;

data implementation OuterD.bidirectional extends OuterD.generic
connections
dac1: data access daf2 <-> inner.daf1;
end OuterD.bidirectional;

data implementation OuterD.fromSharedComponent extends OuterD.generic
connections
dac1: data access daf2 -> inner.daf1;
end OuterD.fromSharedComponent;

data implementation OuterD.toSharedComponent extends OuterD.generic
connections
dac1: data access inner.daf1 -> daf2;
end OuterD.toSharedComponent;

system Root
end Root;

system implementation Root.generic
subcomponents
shareMe: data ShareMe;
outer: data OuterD.generic;
end Root.generic;

system implementation Root.bidirectional extends Root.generic
subcomponents
outer: refined to data OuterD.bidirectional;
connections
dac2: data access shareMe <-> outer.daf2;
end Root.bidirectional;

system implementation Root.fromSharedComponent extends Root.generic
subcomponents
outer: refined to data OuterD.fromSharedComponent;
connections
dac2: data access shareMe -> outer.daf2;
end Root.fromSharedComponent;

system implementation Root.toSharedComponent extends Root.generic
subcomponents
outer: refined to data OuterD.toSharedComponent;
connections
dac2: data access outer.daf2 -> shareMe;
end Root.toSharedComponent;
end SharedData_to_Data_Nested_in_Data;
@@ -0,0 +1,88 @@
package SharedData_to_Data_Nested_in_Thread
public
data ShareMe
end ShareMe;

data InnerD
features
daf1: requires data access ShareMe;
end InnerD;

thread OuterT
features
daf2: requires data access ShareMe;
end OuterT;

thread implementation OuterT.generic
subcomponents
inner: data InnerD;
end OuterT.generic;

thread implementation OuterT.bidirectional extends OuterT.generic
connections
dac1: data access daf2 <-> inner.daf1;
end OuterT.bidirectional;

thread implementation OuterT.fromSharedComponent extends OuterT.generic
connections
dac1: data access daf2 -> inner.daf1;
end OuterT.fromSharedComponent;

thread implementation OuterT.toSharedComponent extends OuterT.generic
connections
dac1: data access inner.daf1 -> daf2;
end OuterT.toSharedComponent;

process P
end P;

process implementation P.generic
subcomponents
shareMe: data ShareMe;
outer: thread OuterT.generic;
end P.generic;

process implementation P.bidirectional extends P.generic
subcomponents
outer: refined to thread OuterT.bidirectional;
connections
dac2: data access shareMe <-> outer.daf2;
end P.bidirectional;

process implementation P.fromSharedComponent extends P.generic
subcomponents
outer: refined to thread OuterT.fromSharedComponent;
connections
dac2: data access shareMe -> outer.daf2;
end P.fromSharedComponent;

process implementation P.toSharedComponent extends P.generic
subcomponents
outer: refined to thread OuterT.toSharedComponent;
connections
dac2: data access outer.daf2 -> shareMe;
end P.toSharedComponent;

system Root
end Root;

system implementation Root.generic
subcomponents
myProcess: process P.generic;
end Root.generic;

system implementation Root.bidirectional extends Root.generic
subcomponents
myProcess: refined to process P.bidirectional;
end Root.bidirectional;

system implementation Root.fromSharedComponent extends Root.generic
subcomponents
myProcess: refined to process P.fromSharedComponent;
end Root.fromSharedComponent;

system implementation Root.toSharedComponent extends Root.generic
subcomponents
myProcess: refined to process P.toSharedComponent;
end Root.toSharedComponent;
end SharedData_to_Data_Nested_in_Thread;
@@ -0,0 +1,34 @@
package SharedData_to_Data_Peers
public
data ShareMe
end ShareMe;

data D
features
daf: requires data access ShareMe;
end D;

system Root
end Root;

system implementation Root.generic
subcomponents
shareMe: data ShareMe;
d: data D;
end Root.generic;

system implementation Root.bidirectional extends Root.generic
connections
dac: data access shareMe <-> d.daf;
end Root.bidirectional;

system implementation Root.fromSharedComponent extends Root.generic
connections
dac: data access shareMe -> d.daf;
end Root.fromSharedComponent;

system implementation Root.toSharedComponent extends Root.generic
connections
dac: data access d.daf -> shareMe;
end Root.toSharedComponent;
end SharedData_to_Data_Peers;
@@ -0,0 +1,65 @@
package SharedData_to_Subprogram_Nested_in_Data
public
data ShareMe
end ShareMe;

subprogram InnerS
features
daf1: requires data access ShareMe;
end InnerS;

data OuterD
features
daf2: requires data access ShareMe;
end OuterD;

data implementation OuterD.generic
subcomponents
inner: subprogram InnerS;
end OuterD.generic;

data implementation OuterD.bidirectional extends OuterD.generic
connections
dac1: data access daf2 <-> inner.daf1;
end OuterD.bidirectional;

data implementation OuterD.fromSharedComponent extends OuterD.generic
connections
dac1: data access daf2 -> inner.daf1;
end OuterD.fromSharedComponent;

data implementation OuterD.toSharedComponent extends OuterD.generic
connections
dac1: data access inner.daf1 -> daf2;
end OuterD.toSharedComponent;

system Root
end Root;

system implementation Root.generic
subcomponents
shareMe: data ShareMe;
outer: data OuterD.generic;
end Root.generic;

system implementation Root.bidirectional extends Root.generic
subcomponents
outer: refined to data OuterD.bidirectional;
connections
dac2: data access shareMe <-> outer.daf2;
end Root.bidirectional;

system implementation Root.fromSharedComponent extends Root.generic
subcomponents
outer: refined to data OuterD.fromSharedComponent;
connections
dac2: data access shareMe -> outer.daf2;
end Root.fromSharedComponent;

system implementation Root.toSharedComponent extends Root.generic
subcomponents
outer: refined to data OuterD.toSharedComponent;
connections
dac2: data access outer.daf2 -> shareMe;
end Root.toSharedComponent;
end SharedData_to_Subprogram_Nested_in_Data;