Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/.aadlbin-gen/
18 changes: 18 additions & 0 deletions emv2/org.osate.aadl2.errormodel.tests/models/Issue1735/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Issue1735</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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package inverse_bug
public
feature group a
features
in_port1: in data port;
end a;

feature group b
features
out_port1: out data port;
inverse of a
end b;

feature group c
features
in_port2: in data port;
end c;

feature group d
inverse of c
end d;

system s
features
fg1: feature group b;
fg2: feature group d;
annex EMV2 {**
error propagations
fg1.out_port1: out propagation {ErrorLibrary::AboveRange};
fg2.in_port2: out propagation {ErrorLibrary::AboveRange};
end propagations;
**};
end s;
end inverse_bug;
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package org.osate.aadl2.errormodel.tests.issues

import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.eclipse.xtext.testing.validation.ValidationTestHelper
import org.junit.Test
import org.junit.runner.RunWith
import org.osate.aadl2.AadlPackage
import org.osate.aadl2.errormodel.tests.ErrorModelInjectorProvider
import org.osate.testsupport.TestHelper

@RunWith(XtextRunner)
@InjectWith(ErrorModelInjectorProvider)
class Issue1735 {
val static PROJECT_LOCATION = "org.osate.aadl2.errormodel.tests/models/Issue1735/"

@Inject
TestHelper<AadlPackage> testHelper

@Inject
extension ValidationTestHelper

@Test
def void testIssue1735() {
testHelper.parseFile(PROJECT_LOCATION + "inverse_bug.aadl").assertNoIssues
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -187,8 +186,7 @@ public static ComponentClassifier getAssociatedClassifier(Element emv2Element) {
// we are not inside an EMV2 subclause
return null;
}
return Aadl2GlobalScopeUtil.get(emsc,
Aadl2Package.eINSTANCE.getComponentClassifier(), emsc.getQualifiedName());
return Aadl2GlobalScopeUtil.get(emsc, Aadl2Package.eINSTANCE.getComponentClassifier(), emsc.getQualifiedName());
}

/**
Expand All @@ -197,8 +195,8 @@ public static ComponentClassifier getAssociatedClassifier(Element emv2Element) {
* @return ErrorModelSubclause
*/
public static ErrorModelSubclause getAssociatedEMV2Subclause(ComponentClassifier cl) {
return Aadl2GlobalScopeUtil.get(cl,
ErrorModelPackage.eINSTANCE.getErrorModelSubclause(), cl.getQualifiedName());
return Aadl2GlobalScopeUtil.get(cl, ErrorModelPackage.eINSTANCE.getErrorModelSubclause(),
cl.getQualifiedName());
}

/**
Expand Down Expand Up @@ -285,8 +283,7 @@ public static List<NamedElement> findDoubleNamedElementsInList(Collection<?> el)
final Set<String> seen = new HashSet<String>();

if (el != null) {
for (final Iterator i = el.iterator(); i.hasNext();) {
final Object obj = i.next();
for (final Object obj : el) {
if (obj instanceof NamedElement && !(obj instanceof ErrorPropagation)) {
final NamedElement lit = (NamedElement) obj;
String name = lit.getName();
Expand Down Expand Up @@ -2826,78 +2823,83 @@ public static boolean hasOutgoingPropagationCondition(ComponentClassifier cl) {
* @param ci ComponentInstance
* @return EList of leaf component instances
*/
@SuppressWarnings("unchecked")
public static EList<ComponentInstance> getComponentInstancesWithEMV2Subclause(ComponentInstance ci) {
EList result = new ForAllElement() {
EList<?> result = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
return (obj instanceof ComponentInstance && (EMV2Util.hasEMV2Subclause((ComponentInstance) obj)));
}
}.processPreOrderComponentInstance(ci);
return result;
return (EList<ComponentInstance>) result;
}

/**
* retrieve list of component instances that have error propagations specified
* @param ci ComponentInstance
* @return EList of leaf component instances
*/
@SuppressWarnings("unchecked")
public static EList<ComponentInstance> getComponentInstancesWithErrorPropagations(ComponentInstance ci) {
EList result = new ForAllElement() {
EList<?> result = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
return (obj instanceof ComponentInstance && (EMV2Util.hasErrorPropagations((ComponentInstance) obj)));
}
}.processPreOrderComponentInstance(ci);
return result;
return (EList<ComponentInstance>) result;
}

/**
* retrieve list of component instances that have component error behavior specified
* @param ci ComponentInstance
* @return EList of leaf component instances
*/
@SuppressWarnings("unchecked")
public static EList<ComponentInstance> getComponentInstancesWithComponentErrorBehaviorStates(ComponentInstance ci) {
EList result = new ForAllElement() {
EList<?> result = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
return (obj instanceof ComponentInstance
&& (EMV2Util.hasComponentErrorBehaviorStates((ComponentInstance) obj)));
}
}.processPreOrderComponentInstance(ci);
return result;
return (EList<ComponentInstance>) result;
}

/**
* retrieve list of component instances that have component error behavior specified
* @param ci ComponentInstance
* @return EList of leaf component instances
*/
@SuppressWarnings("unchecked")
public static EList<ComponentInstance> getComponentInstancesWithComponentErrorBehaviorTransitions(
ComponentInstance ci) {
EList result = new ForAllElement() {
EList<?> result = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
return (obj instanceof ComponentInstance
&& (EMV2Util.hasComponentErrorBehaviorTransitions((ComponentInstance) obj)));
}
}.processPreOrderComponentInstance(ci);
return result;
return (EList<ComponentInstance>) result;
}

/**
* retrieve list of component instances that have composite error behavior specified
* @param ci ComponentInstance
* @return EList of leaf component instances
*/
@SuppressWarnings("unchecked")
public static EList<ComponentInstance> getComponentInstancesWithCompositeErrorBehavior(ComponentInstance ci) {
EList result = new ForAllElement() {
EList<?> result = new ForAllElement() {
@Override
protected boolean suchThat(Element obj) {
return (obj instanceof ComponentInstance
&& (EMV2Util.hasCompositeErrorBehavior((ComponentInstance) obj)));
}
}.processPreOrderComponentInstance(ci);
return result;
return (EList<ComponentInstance>) result;
}

/**
Expand Down Expand Up @@ -2967,7 +2969,8 @@ public static DirectionType getErrorPropagationFeatureDirection(ErrorPropagation
if (fg.isInverse()) {
inverse = !inverse;
}
if (fgt != null && fgt.getInverse() != null) {
if (fgt != null && fgt.getInverse() != null
&& !fgt.getOwnedFeatures().contains(fref.getFeatureorPP())) {
inverse = !inverse;
}
}
Expand Down