diff --git a/features/org.eclipse.emf.mwe2.launcher-feature/feature.xml b/features/org.eclipse.emf.mwe2.launcher-feature/feature.xml
index b31689b13..5ca58d93f 100644
--- a/features/org.eclipse.emf.mwe2.launcher-feature/feature.xml
+++ b/features/org.eclipse.emf.mwe2.launcher-feature/feature.xml
@@ -36,7 +36,6 @@ SPDX-License-Identifier: EPL-2.0
-
diff --git a/features/org.eclipse.emf.mwe2.runtime.sdk-feature/feature.xml b/features/org.eclipse.emf.mwe2.runtime.sdk-feature/feature.xml
index ce5137833..28bceb467 100644
--- a/features/org.eclipse.emf.mwe2.runtime.sdk-feature/feature.xml
+++ b/features/org.eclipse.emf.mwe2.runtime.sdk-feature/feature.xml
@@ -30,7 +30,6 @@ SPDX-License-Identifier: EPL-2.0
-
diff --git a/maven/org.eclipse.emf.mwe2.parent/pom.xml b/maven/org.eclipse.emf.mwe2.parent/pom.xml
index 8923d9206..c0b89127e 100644
--- a/maven/org.eclipse.emf.mwe2.parent/pom.xml
+++ b/maven/org.eclipse.emf.mwe2.parent/pom.xml
@@ -30,7 +30,6 @@
2.8.2
3.4.1
1.8.0
- 33.2.1-jre
7.0.0
1.2.25
1.3.3
diff --git a/maven/org.eclipse.emf.mwe2.repository/category.xml b/maven/org.eclipse.emf.mwe2.repository/category.xml
index 5534a1d32..aa491b745 100644
--- a/maven/org.eclipse.emf.mwe2.repository/category.xml
+++ b/maven/org.eclipse.emf.mwe2.repository/category.xml
@@ -6,10 +6,6 @@
-
-
-
-
diff --git a/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.nightly/org.eclipse.emf.mwe2.target.nightly.target b/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.nightly/org.eclipse.emf.mwe2.target.nightly.target
index 03f5f0276..b52d5c483 100644
--- a/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.nightly/org.eclipse.emf.mwe2.target.nightly.target
+++ b/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.nightly/org.eclipse.emf.mwe2.target.nightly.target
@@ -28,8 +28,6 @@
-
-
diff --git a/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.target b/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.target
index a8195464f..c96c77852 100644
--- a/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.target
+++ b/maven/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.target
@@ -29,8 +29,6 @@
-
-
diff --git a/plugins/org.eclipse.emf.mwe2.language.ide/src-gen/org/eclipse/emf/mwe2/language/ide/contentassist/antlr/Mwe2Parser.java b/plugins/org.eclipse.emf.mwe2.language.ide/src-gen/org/eclipse/emf/mwe2/language/ide/contentassist/antlr/Mwe2Parser.java
index ac046f213..396b32efa 100644
--- a/plugins/org.eclipse.emf.mwe2.language.ide/src-gen/org/eclipse/emf/mwe2/language/ide/contentassist/antlr/Mwe2Parser.java
+++ b/plugins/org.eclipse.emf.mwe2.language.ide/src-gen/org/eclipse/emf/mwe2/language/ide/contentassist/antlr/Mwe2Parser.java
@@ -8,9 +8,10 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.ide.contentassist.antlr;
-import com.google.common.collect.ImmutableMap;
import com.google.inject.Inject;
import com.google.inject.Singleton;
+
+import java.util.HashMap;
import java.util.Map;
import org.eclipse.emf.mwe2.language.ide.contentassist.antlr.internal.InternalMwe2Parser;
import org.eclipse.emf.mwe2.language.services.Mwe2GrammarAccess;
@@ -26,16 +27,16 @@ public static final class NameMappings {
@Inject
public NameMappings(Mwe2GrammarAccess grammarAccess) {
- ImmutableMap.Builder builder = ImmutableMap.builder();
+ Map builder = new HashMap<>();
init(builder, grammarAccess);
- this.mappings = builder.build();
+ this.mappings = Map.copyOf(builder);
}
public String getRuleName(AbstractElement element) {
return mappings.get(element);
}
-
- private static void init(ImmutableMap.Builder builder, Mwe2GrammarAccess grammarAccess) {
+
+ private static void init(Map builder, Mwe2GrammarAccess grammarAccess) {
builder.put(grammarAccess.getRootComponentAccess().getAlternatives_1(), "rule__RootComponent__Alternatives_1");
builder.put(grammarAccess.getComponentAccess().getAlternatives_1(), "rule__Component__Alternatives_1");
builder.put(grammarAccess.getValueAccess().getAlternatives(), "rule__Value__Alternatives");
diff --git a/plugins/org.eclipse.emf.mwe2.language.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.mwe2.language.ui/META-INF/MANIFEST.MF
index 2897936db..bdf49bd1c 100644
--- a/plugins/org.eclipse.emf.mwe2.language.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.mwe2.language.ui/META-INF/MANIFEST.MF
@@ -20,7 +20,6 @@ Require-Bundle: org.eclipse.emf.mwe2.language;visibility:=reexport,
org.eclipse.jdt.ui;bundle-version="3.26.0",
org.eclipse.compare,
org.eclipse.xtext.ui.codetemplates.ui,
- com.google.guava;bundle-version="[33.2.1,34.0.0)",
org.eclipse.emf.mwe2.runtime,
org.eclipse.emf.mwe2.language.ide
Import-Package: org.apache.log4j;version="1.2.24"
diff --git a/plugins/org.eclipse.emf.mwe2.language.ui/src-gen/org/eclipse/emf/mwe2/language/ui/internal/LanguageActivator.java b/plugins/org.eclipse.emf.mwe2.language.ui/src-gen/org/eclipse/emf/mwe2/language/ui/internal/LanguageActivator.java
index 8cfe3dbc4..e6f408aa2 100644
--- a/plugins/org.eclipse.emf.mwe2.language.ui/src-gen/org/eclipse/emf/mwe2/language/ui/internal/LanguageActivator.java
+++ b/plugins/org.eclipse.emf.mwe2.language.ui/src-gen/org/eclipse/emf/mwe2/language/ui/internal/LanguageActivator.java
@@ -8,10 +8,10 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.ui.internal;
-import com.google.common.collect.Maps;
import com.google.inject.Guice;
import com.google.inject.Injector;
import java.util.Collections;
+import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Logger;
import org.eclipse.emf.mwe2.language.Mwe2RuntimeModule;
@@ -34,7 +34,7 @@ public class LanguageActivator extends AbstractUIPlugin {
private static LanguageActivator INSTANCE;
- private Map injectors = Collections.synchronizedMap(Maps. newHashMapWithExpectedSize(1));
+ private Map injectors = Collections.synchronizedMap(new HashMap<>(1));
@Override
public void start(BundleContext context) throws Exception {
diff --git a/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/contentassist/Mwe2ProposalProvider.java b/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/contentassist/Mwe2ProposalProvider.java
index feb9702b3..fc15c8e8c 100644
--- a/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/contentassist/Mwe2ProposalProvider.java
+++ b/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/contentassist/Mwe2ProposalProvider.java
@@ -9,6 +9,8 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.ui.contentassist;
+import java.util.function.Function;
+
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.mwe2.language.mwe2.Assignment;
import org.eclipse.emf.mwe2.language.mwe2.Component;
@@ -27,7 +29,6 @@
import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
-import com.google.common.base.Function;
import com.google.inject.Inject;
/**
diff --git a/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenDefProvider.java b/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenDefProvider.java
index 9f51c3480..6520023f5 100644
--- a/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenDefProvider.java
+++ b/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenDefProvider.java
@@ -16,18 +16,16 @@
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
-import com.google.common.collect.ImmutableMap;
-
public class TokenDefProvider implements ITokenDefProvider, IAntlrTokenFileProvider {
- private ImmutableMap map;
+ private Map map;
@Override
public Map getTokenDefMap() {
if (map == null) {
AntlrTokenDefProvider provider = new AntlrTokenDefProvider();
provider.setAntlrTokenFileProvider(this);
- map = ImmutableMap.copyOf(provider.getTokenDefMap());
+ map = Map.copyOf(provider.getTokenDefMap());
}
return map;
}
diff --git a/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenToAttributeMapper.java b/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenToAttributeMapper.java
index 18f1e09d9..a1dc51ff1 100644
--- a/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenToAttributeMapper.java
+++ b/plugins/org.eclipse.emf.mwe2.language.ui/src/org/eclipse/emf/mwe2/language/ui/highlighting/TokenToAttributeMapper.java
@@ -14,12 +14,10 @@
import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultAntlrTokenToAttributeIdMapper;
import org.eclipse.xtext.ui.editor.syntaxcoloring.DefaultHighlightingConfiguration;
-import com.google.common.collect.ImmutableSet;
-
public class TokenToAttributeMapper extends
DefaultAntlrTokenToAttributeIdMapper {
- private final Set keywords = ImmutableSet.of(
+ private final Set keywords = Set.of(
"KEYWORD_TRUE",
"KEYWORD_FALSE",
"KEYWORD_VAR",
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/Mwe2ValueConverters.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/Mwe2ValueConverters.java
index b365b8e4a..720b45876 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/Mwe2ValueConverters.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/Mwe2ValueConverters.java
@@ -21,14 +21,12 @@
import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.util.Strings;
-import com.google.common.collect.ImmutableSet;
-
public class Mwe2ValueConverters extends DefaultTerminalConverters {
public class FQNConverter extends AbstractNullSafeConverter {
-
- private Set allKeywords = ImmutableSet.copyOf(GrammarUtil.getAllKeywords(getGrammar()));
-
+
+ private Set allKeywords = Set.copyOf(GrammarUtil.getAllKeywords(getGrammar()));
+
@Override
protected String internalToValue(String string, INode node) {
return string.replaceAll("[\\^\\s]", "");
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/Mwe2ExecutionEngine.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/Mwe2ExecutionEngine.java
index 631f87100..1c8b7cb8f 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/Mwe2ExecutionEngine.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/Mwe2ExecutionEngine.java
@@ -9,6 +9,9 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.factory;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -36,9 +39,6 @@
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.util.PolymorphicDispatcher;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Sets;
import com.google.inject.Inject;
public class Mwe2ExecutionEngine {
@@ -58,11 +58,11 @@ public class Mwe2ExecutionEngine {
private IQualifiedNameConverter qualifiedNameConverter;
public Object execute(Module m) {
- return create(m, Maps.newHashMap());
+ return create(m, new HashMap<>());
}
public Object create(Module m, Map params) {
- return internalSwitch(m, Maps.newHashMap(params));
+ return internalSwitch(m, new HashMap<>(params));
}
protected Object internalSwitch(Object o, Map variables) {
@@ -93,10 +93,9 @@ protected Object inCase(DeclaredProperty prop, Map variab
}
protected Object inCase(Component comp, Map variables) {
- List assignments = Lists.newArrayList(comp.getAssignment());
+ List assignments = new ArrayList<>(comp.getAssignment());
if (comp.getModule() != null) {
- Map params = comp.isAutoInject() ? Maps
- .newHashMap(variables) : Maps. newHashMap();
+ Map params = comp.isAutoInject() ? new HashMap<>(variables) : new HashMap<>();
for (Assignment ass : assignments) {
params.put(qualifiedNameConverter.toQualifiedName(((DeclaredProperty)ass.getFeature()).getName()),
internalSwitch(ass.getValue(), variables));
@@ -127,7 +126,7 @@ protected void internalApplyAssignments(Object object, JvmType type, boolean isA
List assignments, Map variables) {
Map settings = settingProvider.getSettings(object, type);
if (isAutoInject) {
- Set explicitAssigned = Sets.newHashSet();
+ Set explicitAssigned = new HashSet<>();
for(Assignment assignment: assignments) {
explicitAssigned.add(qualifiedNameConverter.toQualifiedName(assignment.getFeatureName()));
}
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/SettingProviderImpl.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/SettingProviderImpl.java
index 6d4cff79f..575633f8e 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/SettingProviderImpl.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/factory/SettingProviderImpl.java
@@ -11,6 +11,8 @@
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.mwe2.language.scoping.IInjectableFeatureLookup;
@@ -21,16 +23,13 @@
import org.eclipse.xtext.common.types.util.JavaReflectAccess;
import org.eclipse.xtext.naming.QualifiedName;
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Maps;
import com.google.inject.Inject;
public class SettingProviderImpl implements ISettingProvider {
-
+
private IInjectableFeatureLookup injectableFeatureLookup;
private JavaReflectAccess reflectAccess;
-
+
@Inject
public void setReflectAccess(JavaReflectAccess reflectAccess) {
this.reflectAccess = reflectAccess;
@@ -44,8 +43,8 @@ public void setInjectableFeatureLookup(
@Override
public Map getSettings(final Object obj, JvmType type) {
Map features = injectableFeatureLookup.getInjectableFeatures(type);
-
- Iterable settings = Iterables.transform(features.entrySet(), new Function,ISetting>(){
+
+ return features.entrySet().stream().map(new Function, ISetting>() {
@Override
public ISetting apply(final Map.Entry from) {
if (from.getValue() instanceof JvmOperation) {
@@ -59,6 +58,7 @@ public void setValue(Object value) {
throw new WrappedException(e);
}
}
+
@Override
public QualifiedName getName() {
return from.getKey();
@@ -75,6 +75,7 @@ public void setValue(Object value) {
throw new WrappedException(e);
}
}
+
@Override
public QualifiedName getName() {
return from.getKey();
@@ -82,13 +83,8 @@ public QualifiedName getName() {
};
}
throw new IllegalArgumentException(from.getValue().getIdentifier() + " can not be handled.");
- }});
- return Maps.uniqueIndex(settings, new Function() {
- @Override
- public QualifiedName apply(ISetting from) {
- return from.getName();
}
- });
+ }).collect(Collectors.toUnmodifiableMap(ISetting::getName, s -> s));
}
}
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/resource/MweResourceDescriptionStrategy.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/resource/MweResourceDescriptionStrategy.java
index c595e6c03..353e6291d 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/resource/MweResourceDescriptionStrategy.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/resource/MweResourceDescriptionStrategy.java
@@ -8,7 +8,11 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.resource;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
@@ -29,10 +33,6 @@
import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy;
import org.eclipse.xtext.util.IAcceptor;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.ImmutableMap.Builder;
-
/**
* @author Jan Koehnlein - Initial contribution and API
*/
@@ -59,40 +59,39 @@ public boolean createEObjectDescriptions(EObject eObject, IAcceptor builder = ImmutableMap.builder();
+ Map userData = new HashMap<>();
String nodeModelValue = getValueFromNodeModel(property, Mwe2Package.Literals.REFERRABLE__TYPE);
if (nodeModelValue != null) {
- builder.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
+ userData.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
if ((property).getDefault() == null) {
- builder.put(DECLARED_PROPERTY__MANDATORY, MANDATORY_TRUE);
+ userData.put(DECLARED_PROPERTY__MANDATORY, MANDATORY_TRUE);
}
} else {
Value value = (property).getDefault();
if (value == null) {
- builder.put(DECLARED_PROPERTY__TYPE, TYPE__STRING);
- builder.put(DECLARED_PROPERTY__MANDATORY, MANDATORY_TRUE);
+ userData.put(DECLARED_PROPERTY__TYPE, TYPE__STRING);
+ userData.put(DECLARED_PROPERTY__MANDATORY, MANDATORY_TRUE);
} else if (value instanceof BooleanLiteral) {
- builder.put(DECLARED_PROPERTY__TYPE, TYPE__BOOLEAN);
+ userData.put(DECLARED_PROPERTY__TYPE, TYPE__BOOLEAN);
} else if (value instanceof StringLiteral) {
- builder.put(DECLARED_PROPERTY__TYPE, TYPE__STRING);
+ userData.put(DECLARED_PROPERTY__TYPE, TYPE__STRING);
} else if (value instanceof Component) {
nodeModelValue = getValueFromNodeModel(value, Mwe2Package.Literals.COMPONENT__MODULE);
if (nodeModelValue != null) {
- builder.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
+ userData.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
} else {
nodeModelValue = getValueFromNodeModel(value, Mwe2Package.Literals.REFERRABLE__TYPE);
if (nodeModelValue != null)
- builder.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
+ userData.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
}
} else if (value instanceof Reference) {
nodeModelValue = getValueFromNodeModel(value, Mwe2Package.Literals.ABSTRACT_REFERENCE__REFERABLE);
if (nodeModelValue != null) {
- builder.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
+ userData.put(DECLARED_PROPERTY__TYPE, nodeModelValue);
}
}
}
- ImmutableMap userData = builder.build();
- return EObjectDescription.create(qualifiedName, property, userData);
+ return EObjectDescription.create(qualifiedName, property, Collections.unmodifiableMap(userData));
}
protected String getValueFromNodeModel(EObject object, EReference feature) {
@@ -102,7 +101,8 @@ protected String getValueFromNodeModel(EObject object, EReference feature) {
}
if (typeNodes.size() != 1)
throw new IllegalStateException("Unexpected multiple values for feature '" + feature + "' in object '" + object + "'.");
- List leafNodes = Lists.newArrayList(typeNodes.get(0).getLeafNodes());
+ List leafNodes = new ArrayList<>();
+ typeNodes.get(0).getLeafNodes().forEach(leafNodes::add);
StringBuilder result = new StringBuilder();
for(ILeafNode leafNode: leafNodes) {
if(!leafNode.isHidden()) {
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/InjectableFeatureLookup.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/InjectableFeatureLookup.java
index 319346ef0..ea445857e 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/InjectableFeatureLookup.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/InjectableFeatureLookup.java
@@ -9,6 +9,7 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.scoping;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -21,16 +22,13 @@
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.util.Strings;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-
public class InjectableFeatureLookup implements IInjectableFeatureLookup {
@Override
public Map getInjectableFeatures(JvmType type) {
- Map result = Maps.newHashMap();
+ Map result = new HashMap<>();
collectFeatures(type, result);
- return ImmutableMap.copyOf(result);
+ return Map.copyOf(result);
}
public void collectFeatures(JvmType containerType, Map result) {
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/MapBasedScope.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/MapBasedScope.java
index afb8dd222..f2bf4990f 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/MapBasedScope.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/MapBasedScope.java
@@ -24,9 +24,6 @@
import org.eclipse.xtext.scoping.impl.AbstractScope;
import org.eclipse.xtext.util.Strings;
-import com.google.common.base.Function;
-import com.google.common.collect.Iterables;
-
/**
* @author Sebastian Zarnekow - Initial contribution and API
*/
@@ -41,12 +38,7 @@ public MapBasedScope(Map entries) {
@Override
protected Iterable getAllLocalElements() {
- return Iterables.transform(entries.entrySet(), new Function, IEObjectDescription>() {
- @Override
- public IEObjectDescription apply(Map.Entry from) {
- return new MapEntry(from);
- }
- });
+ return () -> entries.entrySet().stream().map(from -> (IEObjectDescription) new MapEntry(from)).iterator();
}
@Override
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/Mwe2ScopeProvider.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/Mwe2ScopeProvider.java
index 29428fc5f..05e56058d 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/Mwe2ScopeProvider.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/Mwe2ScopeProvider.java
@@ -9,8 +9,11 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.scoping;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.function.Function;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
@@ -32,14 +35,11 @@
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.util.SimpleAttributeResolver;
-import com.google.common.base.Function;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
import com.google.inject.Inject;
import com.google.inject.Provider;
/**
- *
+ *
*/
public class Mwe2ScopeProvider extends AbstractDeclarativeScopeProvider {
@@ -48,7 +48,7 @@ public class Mwe2ScopeProvider extends AbstractDeclarativeScopeProvider {
@Inject
private FactorySupport factorySupport;
-
+
@Inject
private Provider nameComputationProvider;
@@ -78,7 +78,7 @@ public IScope scope_AbstractReference_referable(Assignment owner, EReference ref
}
public IScope createReferenceScopeUpTo(EObject object, boolean allowObjects) {
- List result = Lists.newArrayList();
+ List result = new ArrayList<>();
collectReferablesUpTo(object, allowObjects, result);
return createLocalScope(result);
}
@@ -125,7 +125,7 @@ public IScope createComponentFeaturesScope(Component container) {
JvmType containerType = container.getActualType();
if (containerType == null || containerType.eIsProxy())
return IScope.NULLSCOPE;
- Map features = Maps.newHashMap();
+ Map features = new HashMap<>();
JvmType createType = factorySupport.findFactoriesCreationType(containerType);
if (createType != null) {
features.putAll(featureLookup.getInjectableFeatures(createType));
@@ -150,13 +150,13 @@ public IInjectableFeatureLookup getFeatureLookup() {
protected IScope createLocalScope(List extends EObject> elements) {
return Scopes.scopeFor(elements, nameComputationProvider.get(), IScope.NULLSCOPE);
}
-
+
protected static class NameComputation implements Function {
@Inject
private IQualifiedNameConverter qualifiedNameConverter;
private SimpleAttributeResolver nameResolver = SimpleAttributeResolver.newResolver(String.class, "name");
-
+
@Override
public QualifiedName apply(EObject from) {
String name = nameResolver.apply(from);
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/NamespaceAwareScopeProvider.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/NamespaceAwareScopeProvider.java
index f6fc30380..caac5bc8d 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/NamespaceAwareScopeProvider.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/scoping/NamespaceAwareScopeProvider.java
@@ -9,8 +9,7 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.scoping;
-import static com.google.common.collect.Lists.*;
-
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.EObject;
@@ -23,7 +22,7 @@ public class NamespaceAwareScopeProvider extends ImportedNamespaceAwareLocalScop
@Override
protected List getImplicitImports(boolean ignoreCase) {
- List result = newArrayList();
+ List result = new ArrayList<>();
result.add(createImportedNamespaceResolver("java.lang.*", ignoreCase));
result.add(createImportedNamespaceResolver(IWorkflow.class.getPackage().getName() + ".*", ignoreCase));
return result;
@@ -38,7 +37,7 @@ protected boolean isRelativeImport() {
protected List internalGetImportedNamespaceResolvers(final EObject context, boolean ignoreCase) {
List list = super.internalGetImportedNamespaceResolvers(context, ignoreCase);
if (context instanceof Module) {
- list = newArrayList(list);
+ list = new ArrayList<>(list);
String name = ((Module) context).getCanonicalName();
int dot = name.lastIndexOf('.');
if (dot >= 0) {
diff --git a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/validation/Mwe2Validator.java b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/validation/Mwe2Validator.java
index e1ef5646e..c12af2ae0 100644
--- a/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/validation/Mwe2Validator.java
+++ b/plugins/org.eclipse.emf.mwe2.language/src/org/eclipse/emf/mwe2/language/validation/Mwe2Validator.java
@@ -8,8 +8,11 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.validation;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -54,11 +57,6 @@
import org.eclipse.xtext.validation.Check;
import org.eclipse.xtext.validation.ValidationMessageAcceptor;
-import com.google.common.collect.HashMultimap;
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Sets;
import com.google.inject.Inject;
/**
@@ -189,14 +187,14 @@ public void checkCompatibility(DeclaredProperty property) {
@Check
public void checkReferables(Module referable) {
TreeIterator iterator = referable.eResource().getAllContents();
- Set referenced = Sets.newHashSet();
- Multimap declared = HashMultimap.create();
+ Set referenced = new HashSet<>();
+ Map> declared = new HashMap<>();
while (iterator.hasNext()) {
EObject next = iterator.next();
if (next instanceof Referrable) {
String name = ((Referrable) next).getName();
if (name != null) {
- declared.put(name, (Referrable) next);
+ declared.computeIfAbsent(name, n -> new HashSet<>()).add((Referrable) next);
}
} else if (next instanceof AbstractReference) {
referenced.add(((AbstractReference) next).getReferable().getName());
@@ -205,7 +203,7 @@ public void checkReferables(Module referable) {
Component component = (Component) next;
if (component.isAutoInject()) {
Set featureNames = collectFeatureNames(component);
- Set explicitlyAssignedFeature = Sets.newHashSet();
+ Set explicitlyAssignedFeature = new HashSet<>();
for(Assignment assignment: component.getAssignment()) {
explicitlyAssignedFeature.add(assignment.getFeatureName());
}
@@ -215,16 +213,16 @@ public void checkReferables(Module referable) {
}
}
}
- Multimap copy = HashMultimap.create(declared);
+ Map> copy = new HashMap<>(declared);
copy.keySet().removeAll(referenced);
- for (Referrable referrable : copy.values()) {
+ copy.values().stream().flatMap(Set::stream).forEach(referrable -> {
warning(
"The var '" + referrable.getName() + "' is never read locally.",
referrable,
Mwe2Package.Literals.REFERRABLE__NAME,
ValidationMessageAcceptor.INSIGNIFICANT_INDEX,
UNUSED_LOCAL);
- }
+ });
for (String name : declared.keySet()) {
Collection collection = declared.get(name);
if (collection.size()>1) {
@@ -241,7 +239,7 @@ public void checkReferables(Module referable) {
}
public Set collectFeatureNames(Component component) {
- Set result = Sets.newHashSet();
+ Set result = new HashSet<>();
IScope scope = scopeProvider.createComponentFeaturesScope(component);
for(IEObjectDescription description: scope.getAllElements()) {
result.add(qualifiedNameConverter.toString(description.getName()));
@@ -307,7 +305,7 @@ public void checkManadatoryFeaturesAssigned(Component component) {
Set assignedFeatures = getAssignedFeatures(availableProperties, component);
mandatoryFeatures.keySet().removeAll(assignedFeatures);
if (!mandatoryFeatures.isEmpty()) {
- List missingAssignments = Lists.newArrayList(mandatoryFeatures.keySet());
+ List missingAssignments = new ArrayList<>(mandatoryFeatures.keySet());
Collections.sort(missingAssignments);
String concatenated = Strings.concat(", ", missingAssignments);
EStructuralFeature feature = null;
@@ -337,7 +335,7 @@ else if (component.getName() != null)
private Set getAssignedFeatures(
Map availableProperties, Component component) {
- Set result = Sets.newHashSet();
+ Set result = new HashSet<>();
if (component.isAutoInject()) {
result.addAll(availableProperties.keySet());
}
@@ -358,9 +356,9 @@ private Set getAssignedFeatures(
}
public Map collectReferablesUpTo(Component component) {
- List result = Lists.newArrayList();
+ List result = new ArrayList<>();
scopeProvider.collectReferablesUpTo(component, true, result);
- Map indexed = Maps.newHashMap();
+ Map indexed = new HashMap<>();
for(Referrable referrable: result) {
if (referrable.getName() != null) {
indexed.put(referrable.getName(), referrable);
@@ -370,7 +368,7 @@ public Map collectReferablesUpTo(Component component) {
}
public Map collectMandatoryFeatures(Component component) {
- Map result = Maps.newHashMap();
+ Map result = new HashMap<>();
IScope scope = scopeProvider.createComponentFeaturesScope(component);
for(IEObjectDescription description: scope.getAllElements()) {
JvmIdentifiableElement jvmFeature = (JvmIdentifiableElement) description.getEObjectOrProxy();
diff --git a/plugins/org.eclipse.emf.mwe2.launch/pom.xml b/plugins/org.eclipse.emf.mwe2.launch/pom.xml
index ef60fb3c9..8dffe19c1 100644
--- a/plugins/org.eclipse.emf.mwe2.launch/pom.xml
+++ b/plugins/org.eclipse.emf.mwe2.launch/pom.xml
@@ -25,11 +25,6 @@
org.eclipse.emf.mwe2.language
${project.version}
-
- com.google.guava
- guava
- ${guava.version}
-
commons-cli
commons-cli
diff --git a/plugins/org.eclipse.emf.mwe2.launch/src/org/eclipse/emf/mwe2/launch/runtime/Mwe2Runner.java b/plugins/org.eclipse.emf.mwe2.launch/src/org/eclipse/emf/mwe2/launch/runtime/Mwe2Runner.java
index 210e338da..b6cceafb7 100644
--- a/plugins/org.eclipse.emf.mwe2.launch/src/org/eclipse/emf/mwe2/launch/runtime/Mwe2Runner.java
+++ b/plugins/org.eclipse.emf.mwe2.launch/src/org/eclipse/emf/mwe2/launch/runtime/Mwe2Runner.java
@@ -31,7 +31,6 @@
import org.eclipse.xtext.resource.IResourceDescription;
import org.eclipse.xtext.resource.IResourceDescriptions;
-import com.google.common.collect.Maps;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -107,7 +106,7 @@ public void run(Module module, Map params, IWorkflowContext ctx)
}
protected Map getRealParams(Map params) {
- HashMap map = Maps.newHashMap();
+ HashMap map = new HashMap<>();
for (Map.Entry param : params.entrySet()) {
map.put(qualifiedNameConverter.toQualifiedName(param.getKey()), param.getValue());
}
diff --git a/plugins/org.eclipse.emf.mwe2.lib/META-INF/MANIFEST.MF b/plugins/org.eclipse.emf.mwe2.lib/META-INF/MANIFEST.MF
index c28315625..5bb3e790d 100644
--- a/plugins/org.eclipse.emf.mwe2.lib/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.emf.mwe2.lib/META-INF/MANIFEST.MF
@@ -10,6 +10,5 @@ Require-Bundle: org.eclipse.emf.mwe2.runtime,
org.eclipse.emf.codegen.ecore;bundle-version="2.29.0";resolution:=optional
Export-Package: org.eclipse.emf.mwe2.ecore,
org.eclipse.emf.mwe2.util
-Import-Package: com.google.common.base;version="[33.2.1,34.0.0)",
- org.apache.log4j;version="1.2.24"
+Import-Package: org.apache.log4j;version="1.2.24"
Automatic-Module-Name: org.eclipse.emf.mwe2.lib
diff --git a/plugins/org.eclipse.emf.mwe2.lib/src/org/eclipse/emf/mwe2/ecore/EcoreGenerator.java b/plugins/org.eclipse.emf.mwe2.lib/src/org/eclipse/emf/mwe2/ecore/EcoreGenerator.java
index 5abce9f29..2b7361e58 100644
--- a/plugins/org.eclipse.emf.mwe2.lib/src/org/eclipse/emf/mwe2/ecore/EcoreGenerator.java
+++ b/plugins/org.eclipse.emf.mwe2.lib/src/org/eclipse/emf/mwe2/ecore/EcoreGenerator.java
@@ -12,6 +12,7 @@
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
+import java.util.function.UnaryOperator;
import org.apache.log4j.Logger;
import org.eclipse.emf.codegen.ecore.generator.Generator;
@@ -38,8 +39,6 @@
import org.eclipse.emf.mwe2.runtime.workflow.IWorkflowComponent;
import org.eclipse.emf.mwe2.runtime.workflow.IWorkflowContext;
-import com.google.common.base.Function;
-
public class EcoreGenerator implements IWorkflowComponent {
private static Logger log = Logger.getLogger(EcoreGenerator.class);
@@ -169,12 +168,11 @@ private ResourceSet getResourceSet() {
return resourceSet == null ? new ResourceSetImpl() : resourceSet;
}
- protected Function getTypeMapper() {
+ protected UnaryOperator getTypeMapper() {
return new mapper();
}
-
- protected final class mapper implements Function {
+ protected final class mapper implements UnaryOperator {
public String apply(String from) {
if (from.startsWith("org.eclipse.emf.ecore"))
return null;
@@ -293,13 +291,13 @@ protected void createImportManager(String packageName, String className) {
}
}
- private Function typeMapper;
+ private UnaryOperator typeMapper;
- protected GeneratorAdapterDescriptor(Function typeMapper) {
+ protected GeneratorAdapterDescriptor(UnaryOperator typeMapper) {
this.typeMapper = typeMapper;
}
-
- public GeneratorAdapterDescriptor(Function typeMapper, String lineDelimiter) {
+
+ public GeneratorAdapterDescriptor(UnaryOperator typeMapper, String lineDelimiter) {
super(lineDelimiter);
this.typeMapper = typeMapper;
}
@@ -312,9 +310,9 @@ public GeneratorAdapterFactory createAdapterFactory() {
protected static class ImportManagerHack extends ImportManager {
- private Function typeMapper;
+ private UnaryOperator typeMapper;
- public ImportManagerHack(String compilationUnitPackage, Function typeMapper) {
+ public ImportManagerHack(String compilationUnitPackage, UnaryOperator typeMapper) {
super(compilationUnitPackage);
this.typeMapper = typeMapper;
}
diff --git a/tests/org.eclipse.emf.mwe2.language.tests/org.eclipse.emf.mwe2.language.tests.launch b/tests/org.eclipse.emf.mwe2.language.tests/org.eclipse.emf.mwe2.language.tests.launch
index 5c0bef14a..82d708ba3 100644
--- a/tests/org.eclipse.emf.mwe2.language.tests/org.eclipse.emf.mwe2.language.tests.launch
+++ b/tests/org.eclipse.emf.mwe2.language.tests/org.eclipse.emf.mwe2.language.tests.launch
@@ -36,7 +36,7 @@
-
+
diff --git a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/container/Mwe2ContainerTest.java b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/container/Mwe2ContainerTest.java
index 48cd6197d..cf4dc6d75 100644
--- a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/container/Mwe2ContainerTest.java
+++ b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/container/Mwe2ContainerTest.java
@@ -8,13 +8,14 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.tests.container;
-import java.util.Collections;
import java.util.List;
+import java.util.Map;
+import java.util.Set;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.emf.mwe2.language.mwe2.Module;
+import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.xtext.mwe.ContainersStateFactory;
import org.eclipse.xtext.resource.XtextResourceSet;
import org.eclipse.xtext.resource.containers.DelegatingIAllContainerAdapter;
@@ -26,8 +27,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import com.google.common.collect.Multimaps;
-import com.google.common.collect.SetMultimap;
import com.google.inject.Inject;
/**
@@ -56,9 +55,8 @@ public void testFileNotOnClasspath() throws Exception {
// configure container for this file
final String CONTAINER = "mycontainer";
- SetMultimap mapped = Multimaps.forMap(Collections.singletonMap(CONTAINER, target));
- List containers = Collections.singletonList(CONTAINER);
- IAllContainersState containersState = stateFactory.getContainersState(containers, mapped);
+ Map> mapped = Map.of(CONTAINER, Set.of(target));
+ IAllContainersState containersState = stateFactory.getContainersState(List.of(CONTAINER), mapped);
rs.eAdapters().add(new DelegatingIAllContainerAdapter(containersState));
// assume we can link to the first file even though the new file is not contained in any container
diff --git a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/factory/ComponentA.java b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/factory/ComponentA.java
index db48360a2..f75012f65 100644
--- a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/factory/ComponentA.java
+++ b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/factory/ComponentA.java
@@ -9,13 +9,12 @@
*******************************************************************************/
package org.eclipse.emf.mwe2.language.tests.factory;
+import java.util.ArrayList;
import java.util.List;
-import com.google.common.collect.Lists;
-
public class ComponentA {
private ComponentA x;
- private List y = Lists.newArrayList();
+ private List y = new ArrayList<>();
private String z;
private int i;
private double d;
diff --git a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/parser/AbstractParserTest.java b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/parser/AbstractParserTest.java
index 0ac6a5361..9029009f7 100644
--- a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/parser/AbstractParserTest.java
+++ b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/parser/AbstractParserTest.java
@@ -12,17 +12,19 @@
import static org.junit.Assert.*;
import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.List;
-import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.emf.mwe2.language.parser.antlr.Mwe2Parser;
import org.eclipse.emf.mwe2.language.services.Mwe2GrammarAccess;
+import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.xtext.ParserRule;
+import org.eclipse.xtext.nodemodel.INode;
import org.eclipse.xtext.parser.IParseResult;
import org.eclipse.xtext.testing.InjectWith;
import org.eclipse.xtext.testing.XtextRunner;
import org.junit.runner.RunWith;
-import com.google.common.collect.Iterables;
import com.google.inject.Inject;
@RunWith(XtextRunner.class)
@@ -40,16 +42,23 @@ protected Mwe2GrammarAccess getGrammarAccess() {
protected IParseResult parseSuccessfully(String input) {
IParseResult result = getParseResultFromParser(input);
- assertFalse("[" + input + "] - " + Iterables.toString(result.getSyntaxErrors()), result.hasSyntaxErrors());
+ assertFalse("[" + input + "] - " + toList(result.getSyntaxErrors()).toString(), result.hasSyntaxErrors());
return result;
}
protected IParseResult parseWithErrors(String input, int errorCount) {
IParseResult result = getParseResultFromParser(input);
- assertEquals("[" + input + "] - " + Iterables.toString(result.getSyntaxErrors()), errorCount, Iterables.size(result.getSyntaxErrors()));
+ List syntaxErrors = toList(result.getSyntaxErrors());
+ assertEquals("[" + input + "] - " + syntaxErrors, errorCount, syntaxErrors.size());
return result;
}
+ private static List toList(Iterable elements) {
+ List list = new ArrayList<>();
+ elements.forEach(list::add);
+ return list;
+ }
+
protected IParseResult getParseResultFromParser(String input) {
return parser.parse(getRule(), new StringReader(input));
}
diff --git a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/resource/MweResourceDescriptionManagerTest.java b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/resource/MweResourceDescriptionManagerTest.java
index 40e7054f9..2d1819798 100644
--- a/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/resource/MweResourceDescriptionManagerTest.java
+++ b/tests/org.eclipse.emf.mwe2.language.tests/src/org/eclipse/emf/mwe2/language/tests/resource/MweResourceDescriptionManagerTest.java
@@ -10,12 +10,13 @@
import static org.junit.Assert.*;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.emf.mwe2.language.mwe2.Module;
import org.eclipse.emf.mwe2.language.resource.MweResourceDescriptionStrategy;
+import org.eclipse.emf.mwe2.language.tests.Mwe2InjectorProvider;
import org.eclipse.xtext.naming.QualifiedName;
import org.eclipse.xtext.resource.IEObjectDescription;
import org.eclipse.xtext.resource.IResourceDescription;
@@ -25,7 +26,6 @@
import org.junit.Test;
import org.junit.runner.RunWith;
-import com.google.common.collect.Lists;
import com.google.inject.Inject;
@RunWith(XtextRunner.class)
@@ -42,7 +42,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testNoProperties() throws Exception {
IResourceDescription description = getDescription("");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(1, exported.size());
IEObjectDescription module = exported.get(0);
assertEquals(ORG_FOO_BAR, module.getName());
@@ -51,7 +51,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testMandatoryExplicitString() throws Exception {
IResourceDescription description = getDescription("var String zonk");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -61,7 +61,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testMandatoryImplicitString() throws Exception {
IResourceDescription description = getDescription("var zonk");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -71,7 +71,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testExplicitString() throws Exception {
IResourceDescription description = getDescription("var String zonk = ''");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -81,7 +81,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testImplicitString() throws Exception {
IResourceDescription description = getDescription("var zonk = ''");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -91,7 +91,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testMandatoryExplicitBoolean() throws Exception {
IResourceDescription description = getDescription("var boolean zonk");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -101,7 +101,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testImplicitBoolean() throws Exception {
IResourceDescription description = getDescription("var zonk = true");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -111,7 +111,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testExplicitBoolean() throws Exception {
IResourceDescription description = getDescription("var boolean zonk = true");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -121,7 +121,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testImplicitComponent() throws Exception {
IResourceDescription description = getDescription("var zonk = @ /* comment */ org . foo . Bar {}");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -131,7 +131,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testImplicitClass() throws Exception {
IResourceDescription description = getDescription("var zonk = java.util.ArrayList {}");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -141,7 +141,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testExplicitClass() throws Exception {
IResourceDescription description = getDescription("var java.util.List zonk = java.util. /* comment */ ArrayList {}");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -151,7 +151,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testMandatoryExplicitClass() throws Exception {
IResourceDescription description = getDescription("var java.util.List zonk");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(2, exported.size());
IEObjectDescription zonk = exported.get(1);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -161,7 +161,7 @@ public class MweResourceDescriptionManagerTest {
@Test public void testPropertyReference() throws Exception {
IResourceDescription description = getDescription("var mandatory var zonk = mandatory");
- List exported = Lists.newArrayList(description.getExportedObjects());
+ List exported = getExportedObjects(description);
assertEquals(3, exported.size());
IEObjectDescription zonk = exported.get(2);
assertEquals(ORG_FOO_BAR_ZONK, zonk.getName());
@@ -179,5 +179,11 @@ public IResourceDescription getDescription(String properties) throws Exception {
private Resource getResourceFromString(String model) throws Exception {
return parser.parse(model).eResource();
}
-
+
+ private static List getExportedObjects(IResourceDescription description) {
+ List exported = new ArrayList<>();
+ description.getExportedObjects().forEach(exported::add);
+ return exported;
+ }
+
}