File tree Expand file tree Collapse file tree 2 files changed +8
-15
lines changed
com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/scoping Expand file tree Collapse file tree 2 files changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -46,15 +46,13 @@ public abstract class AbstractScopeNameProvider implements IScopeNameProvider {
4646 */
4747 @ Override
4848 public Iterable <INameFunction > getNameFunctions (final EClass type ) {
49- Iterable <INameFunction > result = nameFunctionCache .get (type );
50- if (result == null ) {
51- result = internalGetNameFunctions (type );
49+ return nameFunctionCache .computeIfAbsent (type , eClass -> {
50+ Iterable <INameFunction > result = internalGetNameFunctions (eClass );
5251 if (result == null ) {
53- result = getDefaultNames (type );
52+ result = getDefaultNames (eClass );
5453 }
55- nameFunctionCache .put (type , result );
56- }
57- return result ;
54+ return result ;
55+ });
5856 }
5957
6058 /**
Original file line number Diff line number Diff line change 1111package com .avaloq .tools .ddk .xtext .scoping ;
1212
1313import java .text .MessageFormat ;
14+ import java .util .Arrays ;
1415
15- import org .apache .logging .log4j .Logger ;
1616import org .apache .logging .log4j .LogManager ;
17+ import org .apache .logging .log4j .Logger ;
1718import org .eclipse .emf .ecore .EObject ;
1819import org .eclipse .emf .ecore .EStructuralFeature ;
1920import org .eclipse .xtext .naming .QualifiedName ;
2021import org .eclipse .xtext .resource .IEObjectDescription ;
2122
2223import com .avaloq .tools .ddk .xtext .naming .QualifiedNames ;
23- import com .google .common .base .Function ;
2424import com .google .common .collect .Iterables ;
2525import com .google .common .collect .Lists ;
2626
@@ -109,12 +109,7 @@ public QualifiedName apply(final EObject from) {
109109 * @return The name functions
110110 */
111111 public static Iterable <INameFunction > fromFeatures (final EStructuralFeature ... nameFeatures ) {
112- return Iterables .transform (Lists .newArrayList (nameFeatures ), new Function <EStructuralFeature , INameFunction >() {
113- @ Override
114- public INameFunction apply (final EStructuralFeature from ) {
115- return fromFeature (from );
116- }
117- });
112+ return Iterables .transform (Arrays .asList (nameFeatures ), NameFunctions ::fromFeature );
118113 }
119114
120115 /**
You can’t perform that action at this time.
0 commit comments