From 1b1ddf91a44cb3816812d255c59ac86fd0f9d0b5 Mon Sep 17 00:00:00 2001
From: Andreas Bayha <bayha@fortiss.org>
Date: Mon, 20 Nov 2023 13:43:07 +0100
Subject: [PATCH] YELLOW

Issue-ref: 4344
Issue-URL: https://git.fortiss.org/af3/af3/-/issues/4344

Signed-off-by: Andreas Bayha <bayha@fortiss.org>
---
 .../tooling/ext/reuse/service/.ratings        |  8 +++---
 .../ext/reuse/service/ReuseProviderBase.java  | 28 +++++++++----------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/.ratings b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/.ratings
index 14f798dcc..f675c9b69 100644
--- a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/.ratings
+++ b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/.ratings
@@ -1,5 +1,5 @@
-IReuseProvider.java 51b197baed33d9b247d7775c3f7dc9ab0b693b43 YELLOW
-IReuseProviderService.java f3ef4206581d13795ed9adb65042b4fc9b4370ed YELLOW
+IReuseProvider.java 18d293f7f1f072883188f16fb6eeb52c8d6042cf GREEN
+IReuseProviderService.java bcc70de0bb8d39c330e3a25d884abc7092dc1b7e GREEN
 LayoutedReuseProviderBase.java b0e4ce3cda818b0723ec37b925a4c4c3d0c41909 GREEN
-ReuseProviderBase.java c28607f29113731a7b2e53592a8b03f0f0d632ba YELLOW
-ReuseProviderService.java c4ef33283002d6dac6167f9c6c8f71d2c2ce39d1 YELLOW
+ReuseProviderBase.java 7d03d329b76ae5099c74498e92e06146ecea5560 YELLOW
+ReuseProviderService.java c4ef33283002d6dac6167f9c6c8f71d2c2ce39d1 GREEN
diff --git a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/ReuseProviderBase.java b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/ReuseProviderBase.java
index c28607f29..7d03d329b 100644
--- a/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/ReuseProviderBase.java
+++ b/org.fortiss.tooling.ext.reuse/src/org/fortiss/tooling/ext/reuse/service/ReuseProviderBase.java
@@ -45,8 +45,8 @@ public class ReuseProviderBase<T extends EObject> implements IReuseProvider<T> {
 	/** {@inheritDoc} */
 	@Override
 	public boolean prepareReuseElementForLibrary(T reuseElement) {
-		if(reuseElement instanceof IHierarchicElementContainer) {
-			removeUnnecessarySpecifications((IHierarchicElementContainer)reuseElement);
+		if(reuseElement instanceof IModelElement) {
+			removeVariabilitySpecifications((IModelElement)reuseElement);
 		}
 		return true;
 	}
@@ -105,23 +105,23 @@ public class ReuseProviderBase<T extends EObject> implements IReuseProvider<T> {
 	}
 
 	/**
-	 * Removes unnecessary specifications from the given element and from all of its contained
-	 * elements. Unnecessary specifications are currently variability-related ones. The method is
-	 * recursion-based!
+	 * Removes unnecessary variability specifications from the given element and from all of its
+	 * contained elements. The method is recursion-based!
 	 */
-	private void removeUnnecessarySpecifications(IHierarchicElementContainer nextElement) {
+	private void removeVariabilitySpecifications(IModelElement nextElement) {
 		// Removal.
-		if(nextElement instanceof IModelElement) {
-			OptionalVariationPointSpecification unnecessarySpec =
-					getOptVarPointSpecification((IModelElement)nextElement);
-			if(unnecessarySpec != null) {
-				((IModelElement)nextElement).getSpecifications().remove(unnecessarySpec);
-			}
+		OptionalVariationPointSpecification unnecessarySpec =
+				getOptVarPointSpecification(nextElement);
+		if(unnecessarySpec != null) {
+			nextElement.getSpecifications().remove(unnecessarySpec);
 		}
 
 		// Recursion.
-		for(IHierarchicElement elem : nextElement.getContainedElements()) {
-			removeUnnecessarySpecifications(elem);
+		if(nextElement instanceof IHierarchicElementContainer) {
+			for(IHierarchicElement elem : ((IHierarchicElementContainer)nextElement)
+					.getContainedElements()) {
+				removeVariabilitySpecifications(elem);
+			}
 		}
 	}
 }
-- 
GitLab