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 @@ -46,15 +46,13 @@ public abstract class AbstractScopeNameProvider implements IScopeNameProvider {
*/
@Override
public Iterable<INameFunction> getNameFunctions(final EClass type) {
Iterable<INameFunction> result = nameFunctionCache.get(type);
if (result == null) {
result = internalGetNameFunctions(type);
return nameFunctionCache.computeIfAbsent(type, eClass -> {
Iterable<INameFunction> result = internalGetNameFunctions(eClass);
if (result == null) {
result = getDefaultNames(type);
result = getDefaultNames(eClass);
}
nameFunctionCache.put(type, result);
}
return result;
return result;
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@
package com.avaloq.tools.ddk.xtext.scoping;

import java.text.MessageFormat;
import java.util.Arrays;

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IEObjectDescription;

import com.avaloq.tools.ddk.xtext.naming.QualifiedNames;
import com.google.common.base.Function;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;

Expand Down Expand Up @@ -109,12 +109,7 @@ public QualifiedName apply(final EObject from) {
* @return The name functions
*/
public static Iterable<INameFunction> fromFeatures(final EStructuralFeature... nameFeatures) {
return Iterables.transform(Lists.newArrayList(nameFeatures), new Function<EStructuralFeature, INameFunction>() {
@Override
public INameFunction apply(final EStructuralFeature from) {
return fromFeature(from);
}
});
return Iterables.transform(Arrays.asList(nameFeatures), NameFunctions::fromFeature);
}

/**
Expand Down