diff options
Diffstat (limited to 'subprojects/language-semantics/src')
-rw-r--r-- | subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java index cc262129..3694f5f4 100644 --- a/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java +++ b/subprojects/language-semantics/src/main/java/tools/refinery/language/semantics/metadata/MetadataCreator.java | |||
@@ -171,16 +171,15 @@ public class MetadataCreator { | |||
171 | 171 | ||
172 | private QualifiedName getSimpleName(EObject eObject, QualifiedName qualifiedName, IScope scope) { | 172 | private QualifiedName getSimpleName(EObject eObject, QualifiedName qualifiedName, IScope scope) { |
173 | var descriptions = scope.getElements(eObject); | 173 | var descriptions = scope.getElements(eObject); |
174 | var names = new HashSet<QualifiedName>(); | 174 | var names = new ArrayList<QualifiedName>(); |
175 | for (var description : descriptions) { | 175 | for (var description : descriptions) { |
176 | // {@code getQualifiedName()} will refer to the full name for objects that are loaded from the global | 176 | // {@code getQualifiedName()} will refer to the full name for objects that are loaded from the global |
177 | // scope, but {@code getName()} returns the qualified name that we set in | 177 | // scope, but {@code getName()} returns the qualified name that we set in |
178 | // {@code ProblemResourceDescriptionStrategy}. | 178 | // {@code ProblemResourceDescriptionStrategy}. |
179 | names.add(description.getName()); | 179 | names.add(description.getName()); |
180 | } | 180 | } |
181 | var iterator = names.stream().sorted(Comparator.comparingInt(QualifiedName::getSegmentCount)).iterator(); | 181 | names.sort(Comparator.comparingInt(QualifiedName::getSegmentCount)); |
182 | while (iterator.hasNext()) { | 182 | for (var simpleName : names) { |
183 | var simpleName = iterator.next(); | ||
184 | if (names.contains(simpleName) && isUnique(scope, simpleName)) { | 183 | if (names.contains(simpleName) && isUnique(scope, simpleName)) { |
185 | return simpleName; | 184 | return simpleName; |
186 | } | 185 | } |