diff --git a/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.62.0-SNAPSHOT.jar b/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.62.0-SNAPSHOT.jar index 2b7ec9ef0..7317d8e42 100644 Binary files a/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.62.0-SNAPSHOT.jar and b/org.omg.sysml.logic.bundle/lib/org.omg.sysml.logic-0.62.0-SNAPSHOT.jar differ diff --git a/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/FeatureAdapter.java b/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/FeatureAdapter.java index b332f58bf..714dd75bc 100644 --- a/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/FeatureAdapter.java +++ b/org.omg.sysml.logic/src/main/java/org/omg/sysml/adapter/FeatureAdapter.java @@ -2,7 +2,7 @@ * SysML 2 Pilot Implementation * Copyright (c) 2021-2026 Model Driven Solutions, Inc. * Copyright (c) 2026 Obeo - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the Eclipse Public License as published by * the Eclipse Foundation, version 2 of the License. @@ -543,7 +543,7 @@ public void getTypes(List types, Set visitedFeatures) { computeImplicitGeneralTypes(); getFeatureTypes(types, visitedFeatures); for (Feature typingFeature : feature.typingFeatures()) { - if (!visitedFeatures.contains(typingFeature)) { + if (typingFeature != null && !visitedFeatures.contains(typingFeature)) { FeatureUtil.getTypesOf(typingFeature, types, visitedFeatures); } } diff --git a/org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/FeatureAdapterTest.java b/org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/FeatureAdapterTest.java new file mode 100644 index 000000000..b80e2b8b4 --- /dev/null +++ b/org.omg.sysml.logic/src/test/java/org/omg/sysml/logic/FeatureAdapterTest.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * SysML 2 Pilot Implementation + * Copyright (c) 2026 Obeo + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the Eclipse Public License as published by + * the Eclipse Foundation, version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * Eclipse Public License for more details. + * + * You should have received a copy of theEclipse Public License + * along with this program. If not, see . + * + * @license EPL-2.0 + * + *******************************************************************************/ + +package org.omg.sysml.logic; + +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; + +import org.junit.Test; +import org.omg.sysml.lang.sysml.Feature; +import org.omg.sysml.lang.sysml.FeatureChaining; +import org.omg.sysml.lang.sysml.SysMLFactory; +import org.omg.sysml.lang.sysml.SysMLPackage; + +/** + * Tests feature derived-property computations implemented by the logic adapters. + */ +public class FeatureAdapterTest { + + /** + * A partially linked feature chain can contribute a null entry to + * typingFeatures(). Type derivation must ignore that unresolved chaining + * target instead of recursing into it. + */ + @Test + public void typeDerivationIgnoresUnresolvedChainingFeature() { + SysMLLogicStandaloneSetup.doSetup(); + SysMLPackage.eINSTANCE.eClass(); + + Feature feature = SysMLFactory.eINSTANCE.createFeature(); + FeatureChaining unresolvedChaining = SysMLFactory.eINSTANCE.createFeatureChaining(); + feature.getOwnedRelationship().add(unresolvedChaining); + + assertNull(feature.typingFeatures().get(0)); + assertTrue(feature.getType().isEmpty()); + } +} diff --git a/org.omg.sysml.model.bundle/lib/org.omg.sysml.model-0.62.0-SNAPSHOT.jar b/org.omg.sysml.model.bundle/lib/org.omg.sysml.model-0.62.0-SNAPSHOT.jar index 9ac46e96f..c11b8c599 100644 Binary files a/org.omg.sysml.model.bundle/lib/org.omg.sysml.model-0.62.0-SNAPSHOT.jar and b/org.omg.sysml.model.bundle/lib/org.omg.sysml.model-0.62.0-SNAPSHOT.jar differ