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
Expand Up @@ -11,7 +11,6 @@
package com.avaloq.tools.ddk.xtext.export.resource;

import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.eclipse.emf.ecore.resource.Resource;
Expand All @@ -37,7 +36,7 @@ protected Set<QualifiedName> getNamedJavaTypes(final Resource resource) {
final Set<QualifiedName> names = new LinkedHashSet<>();
for (final Extension declaration : model.getExtensions()) {
if (declaration.getExtension() != null) {
names.add(javaName(List.of(declaration.getExtension().split("::")))); //$NON-NLS-1$
names.add(javaName(declaration.getExtension().split("::"))); //$NON-NLS-1$
}
}
addExpressionTypeNames(model, names);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
*******************************************************************************/
package com.avaloq.tools.ddk.xtext.expression.resource;

import java.util.Arrays;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.eclipse.emf.ecore.EObject;
Expand Down Expand Up @@ -51,7 +51,7 @@ public Iterable<QualifiedName> getImportedNames() {
}

/**
* Returns the names, as created by {@link #javaName(List)}, of the Java types the model in the given resource names.
* Returns the names, as created by {@link #javaName(String...)}, of the Java types the model in the given resource names.
*
* @param resource
* the resource, must not be {@code null}
Expand All @@ -71,7 +71,7 @@ public Iterable<QualifiedName> getImportedNames() {
protected static void addExpressionTypeNames(final EObject root, final Set<QualifiedName> names) {
root.eAllContents().forEachRemaining(content -> {
if (content instanceof Identifier identifier && identifier.getId().size() > 1) {
names.add(javaName(identifier.getId()));
names.add(javaName(identifier.getId().toArray(String[]::new)));
}
});
}
Expand All @@ -84,7 +84,7 @@ protected static void addExpressionTypeNames(final EObject root, final Set<Quali
* the segments of the qualified type name, must not be {@code null}
* @return the name, never {@code null}
*/
protected static QualifiedName javaName(final List<String> segments) {
return QualifiedName.create(segments.stream().map(segment -> segment.startsWith("^") ? segment.substring(1) : segment).toList()).toLowerCase(); //$NON-NLS-1$
protected static QualifiedName javaName(final String... segments) {
return QualifiedName.create(Arrays.stream(segments).map(segment -> segment.startsWith("^") ? segment.substring(1) : segment).toList()).toLowerCase(); //$NON-NLS-1$
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;

import org.eclipse.emf.ecore.resource.Resource;
Expand Down Expand Up @@ -58,12 +57,12 @@ private static void addNamedJavaTypes(final ScopeModel model, final Set<ScopeMod
}
for (final Extension declaration : model.getExtensions()) {
if (declaration.getExtension() != null) {
names.add(javaName(List.of(declaration.getExtension().split("::")))); //$NON-NLS-1$
names.add(javaName(declaration.getExtension().split("::"))); //$NON-NLS-1$
}
}
for (final Injection injection : model.getInjections()) {
if (injection.getType() != null) {
names.add(javaName(List.of(injection.getType().split("\\.")))); //$NON-NLS-1$
names.add(javaName(injection.getType().split("\\."))); //$NON-NLS-1$
}
}
addExpressionTypeNames(model, names);
Expand Down