Skip to content

Commit

Permalink
[FIXUP] use new Xtext methods to get-rid of all remaining Guava usages
Browse files Browse the repository at this point in the history
  • Loading branch information
HannesWell committed Apr 5, 2024
1 parent 4a70163 commit 8eccab4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 29 deletions.
11 changes: 5 additions & 6 deletions maven/org.eclipse.emf.mwe2.parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@

<properties>
<tycho-qualifier>yyyyMMdd-HHmm</tycho-qualifier>

<tycho-version>2.7.5</tycho-version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven-install-version>2.5.2</maven-install-version>
<maven-deploy-version>2.8.2</maven-deploy-version>
<maven-javadoc-version>3.4.1</maven-javadoc-version>
<commons-cli.version>1.6.0</commons-cli.version>
<guava.version>33.1.0-jre</guava.version>
<google-inject.version>7.0.0</google-inject.version>
<log4j.version>1.2.25</log4j.version>
<commons-logging.version>1.1.3</commons-logging.version>
Expand Down Expand Up @@ -63,7 +62,7 @@
<url>http://www.eclipse.org/legal/epl-2.0</url>
</license>
</licenses>

<pluginRepositories>
<!-- for eclipse-jarsigner-plugin -->
<pluginRepository>
Expand All @@ -77,7 +76,7 @@
</snapshots>
</pluginRepository>
</pluginRepositories>

<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
Expand Down Expand Up @@ -211,7 +210,7 @@
<name>model</name>
<placement>X</placement>
</tag>
</tags>
</tags>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -304,7 +303,7 @@
<module>../org.eclipse.emf.mwe2.target/org.eclipse.emf.mwe2.target.nightly</module>
</modules>
</profile>
<!--
<!--
Profile 'release' is activated when property BUILD_TYPE is NOT 'N' (nightly).
For release builds strict version checking is disabled, since Maven version will be a
release version, while OSGi artifacts (MANIFEST.MF, feature.xml) still contain a qualified version.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,7 @@
<unit id="org.apache.log4j" version="1.2.25"/>
<unit id="org.junit" version="0.0.0"/>
<unit id="org.apache.commons.cli" version="1.6.0"/>
<unit id="org.apache.commons.cli.source" version="1.6.0"/>
<unit id="org.apache.commons.logging" version="0.0.0"/>
<unit id="org.apache.commons.logging.source" version="0.0.0"/>
<unit id="com.google.guava" version="33.1.0.jre"/>
<unit id="com.google.guava.source" version="33.1.0.jre"/>
<unit id="com.google.guava.failureaccess" version="1.0.2"/>
<unit id="com.google.guava.failureaccess.source" version="1.0.2"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-06"/>
</location>
</locations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
<unit id="org.apache.commons.cli.source" version="1.6.0"/>
<unit id="org.apache.commons.logging" version="0.0.0"/>
<unit id="org.apache.commons.logging.source" version="0.0.0"/>
<unit id="com.google.guava" version="33.1.0.jre"/>
<unit id="com.google.guava.source" version="33.1.0.jre"/>
<unit id="com.google.guava.failureaccess" version="1.0.2"/>
<unit id="com.google.guava.failureaccess.source" version="1.0.2"/>
<repository location="https://download.eclipse.org/tools/orbit/simrel/orbit-aggregation/2024-06"/>
</location>
</locations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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;
Expand All @@ -34,12 +35,11 @@
import org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider;
import org.eclipse.xtext.util.SimpleAttributeResolver;

import com.google.common.base.Function;
import com.google.inject.Inject;
import com.google.inject.Provider;

/**
*
*
*/
public class Mwe2ScopeProvider extends AbstractDeclarativeScopeProvider {

Expand All @@ -48,7 +48,7 @@ public class Mwe2ScopeProvider extends AbstractDeclarativeScopeProvider {

@Inject
private FactorySupport factorySupport;

@Inject
private Provider<NameComputation> nameComputationProvider;

Expand Down Expand Up @@ -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<EObject, QualifiedName> {
@Inject
private IQualifiedNameConverter qualifiedNameConverter;

private SimpleAttributeResolver<EObject, String> nameResolver = SimpleAttributeResolver.newResolver(String.class, "name");

@Override
public QualifiedName apply(EObject from) {
String name = nameResolver.apply(from);
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

/**
Expand Down Expand Up @@ -56,9 +55,8 @@ public void testFileNotOnClasspath() throws Exception {

// configure container for this file
final String CONTAINER = "mycontainer";
SetMultimap<String, URI> mapped = Multimaps.forMap(Collections.singletonMap(CONTAINER, target));
List<String> containers = Collections.singletonList(CONTAINER);
IAllContainersState containersState = stateFactory.getContainersState(containers, mapped);
Map<String, Set<URI>> 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
Expand Down

0 comments on commit 8eccab4

Please sign in to comment.