From dbfe315cb3ebfd5fc2529d742b45bc6b6289d88a Mon Sep 17 00:00:00 2001 From: Niklas Kellner Date: Thu, 28 Sep 2023 10:12:07 +0200 Subject: [PATCH] Updated Guice to 7.0.0 (#216) --- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../META-INF/MANIFEST.MF | 5 +- .../di/scope/DefaultDiagramGlobalScope.java | 21 ++--- pom.xml | 3 + targetplatforms/r2023-09.target | 80 +++++++++++++++++++ targetplatforms/r2023-09.tpd | 34 ++++++++ 7 files changed, 133 insertions(+), 14 deletions(-) create mode 100644 targetplatforms/r2023-09.target create mode 100644 targetplatforms/r2023-09.tpd diff --git a/plugins/org.eclipse.glsp.graph/META-INF/MANIFEST.MF b/plugins/org.eclipse.glsp.graph/META-INF/MANIFEST.MF index eb6068fe..867306d1 100644 --- a/plugins/org.eclipse.glsp.graph/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.glsp.graph/META-INF/MANIFEST.MF @@ -9,7 +9,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.emf.common;bundle-version="2.23.0", com.google.gson;bundle-version="2.8.7", org.eclipse.emf.ecore;bundle-version="2.25.0";visibility:=reexport, - com.google.guava;bundle-version="[30.1.0,31.0.0)";visibility:=reexport + com.google.guava;bundle-version="[30.1.0,33.0.0)";visibility:=reexport Export-Package: org.eclipse.glsp.graph, org.eclipse.glsp.graph, org.eclipse.glsp.graph.builder, diff --git a/plugins/org.eclipse.glsp.layout/META-INF/MANIFEST.MF b/plugins/org.eclipse.glsp.layout/META-INF/MANIFEST.MF index caccbce0..6d089458 100644 --- a/plugins/org.eclipse.glsp.layout/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.glsp.layout/META-INF/MANIFEST.MF @@ -9,5 +9,5 @@ Bundle-RequiredExecutionEnvironment: JavaSE-11 Require-Bundle: org.eclipse.glsp.server;bundle-version="[1.0.0,2.0.0)", org.eclipse.elk.core;bundle-version="0.8.1", org.eclipse.elk.graph;bundle-version="0.8.1", - com.google.guava;bundle-version="[30.1.0,31.0.0]" + com.google.guava;bundle-version="[30.1.0,33.0.0)" Export-Package: org.eclipse.glsp.layout diff --git a/plugins/org.eclipse.glsp.server/META-INF/MANIFEST.MF b/plugins/org.eclipse.glsp.server/META-INF/MANIFEST.MF index b5d0b306..38b99ffb 100644 --- a/plugins/org.eclipse.glsp.server/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.glsp.server/META-INF/MANIFEST.MF @@ -11,7 +11,7 @@ Require-Bundle: org.eclipse.emf.ecore.change;bundle-version="2.14.0", org.eclipse.lsp4j;bundle-version="0.11.0", org.eclipse.lsp4j.jsonrpc;bundle-version="0.11.0", org.apache.commons.cli;bundle-version="1.4.0";visibility:=reexport, - com.google.inject;bundle-version="[5.0.1,6.0.0)";visibility:=reexport, + com.google.inject;bundle-version="[5.0.1,8.0.0)";visibility:=reexport, org.eclipse.glsp.graph;bundle-version="[1.0.0,2.0.0)";visibility:=reexport Export-Package: org.eclipse.glsp.server.actions, org.eclipse.glsp.server.di, @@ -57,7 +57,8 @@ Export-Package: org.eclipse.glsp.server.actions, org.eclipse.glsp.server.session, org.eclipse.glsp.server.types, org.eclipse.glsp.server.utils -Import-Package: javax.inject;version="1.0.0", +Import-Package: jakarta.inject;resolution:=optional, + javax.inject;version="1.0.0", org.apache.logging.log4j;version="2.17.1", org.apache.logging.log4j.core;version="2.17.1", org.apache.logging.log4j.core.appender;version="2.17.1", diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/di/scope/DefaultDiagramGlobalScope.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/di/scope/DefaultDiagramGlobalScope.java index f9f57759..860a22d8 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/di/scope/DefaultDiagramGlobalScope.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/internal/di/scope/DefaultDiagramGlobalScope.java @@ -28,9 +28,7 @@ import com.google.inject.Injector; import com.google.inject.Key; import com.google.inject.Provider; -import com.google.inject.internal.SingletonScope; -@SuppressWarnings("restriction") public class DefaultDiagramGlobalScope implements DiagramGlobalScope { private final Map, Object>> diagramTypeStores = new ConcurrentHashMap<>(); @@ -39,14 +37,17 @@ public DefaultDiagramGlobalScope() {} @Override public Provider scope(final Key key, final Provider unscoped) { - return () -> { - Optional diagramType = getDiagramType(unscoped); - if (diagramType.isEmpty()) { - throw new IllegalArgumentException( - "Could not complete scoping operation. Diagram type could not be derived." - + " Injector needs to be create with a 'GLSPDiagramModule'!"); + return new Provider() { + @Override + public T get() { + Optional diagramType = getDiagramType(unscoped); + if (diagramType.isEmpty()) { + throw new IllegalArgumentException( + "Could not complete scoping operation. Diagram type could not be derived." + + " Injector needs to be create with a 'GLSPDiagramModule'!"); + } + return getInstanceFromScope(diagramType.get(), key, unscoped); } - return getInstanceFromScope(diagramType.get(), key, unscoped); }; } @@ -72,7 +73,7 @@ protected Optional getDiagramType(final Provider unscoped) { } /** - * Retrieve the injector from the provider. Looking at the implementation for {@link SingletonScope} + * Retrieve the injector from the provider. Looking at the implementation for SingletonScope * we know that this provider will always be an instance of {@code ProviderToInternalFactoryAdapter}. * From this we can retrieve the injector. However, {@code ProviderToInternalFactoryAdapter} is an internal class * which means we have to use reflection here to access the injector. diff --git a/pom.xml b/pom.xml index e3784745..5cd7fcee 100644 --- a/pom.xml +++ b/pom.xml @@ -238,6 +238,9 @@ ${project.version} + + ignore + diff --git a/targetplatforms/r2023-09.target b/targetplatforms/r2023-09.target new file mode 100644 index 00000000..ff0232c0 --- /dev/null +++ b/targetplatforms/r2023-09.target @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + org.apache.aries.spifly + org.apache.aries.spifly.dynamic.bundle + 1.3.6 + jar + + + + + + + org.slf4j + slf4j-api + 2.0.0 + jar + + + + + + + org.apache.logging.log4j + log4j-slf4j2-impl + 2.19.0 + jar + + + org.apache.logging.log4j + log4j-core + 2.19.0 + jar + + + org.apache.logging.log4j + log4j-api + 2.19.0 + jar + + + + + diff --git a/targetplatforms/r2023-09.tpd b/targetplatforms/r2023-09.tpd new file mode 100644 index 00000000..6d14f32d --- /dev/null +++ b/targetplatforms/r2023-09.tpd @@ -0,0 +1,34 @@ + +target "2023-09 - Default" with source requirements +include "maven-dependencies.tpd" + +location "http://download.eclipse.org/releases/2023-09" { + org.eclipse.emf.sdk.feature.group + org.eclipse.lsp4j [0.19.0,1.0.0) + org.eclipse.lsp4j.websocket [0.19.0,1.0.0) + org.apache.commons.cli [1.4.0,2.0.0) + com.google.gson[2.8.7,3.0.0) + com.google.inject [7.0.0,8.0.0) + com.google.guava [32.0.0,33.0.0) + jakarta.inject.jakarta.inject-api [2.0.1,3.0.0) +} + +location "https://download.eclipse.org/tools/orbit/downloads/drops/R20221123021534/repository/" { + org.junit [4.13.2,5.0.0) + org.junit.jupiter.api [5.8.1,6.0.0) +} + +location "https://download.eclipse.org/elk/updates/releases/0.8.1/" { + org.eclipse.elk.core + org.eclipse.elk.graph + org.eclipse.elk.graph.text + org.eclipse.elk.alg.layered +} + +location "mvn:org.eclipse.jetty:jetty-p2:10.0.13:zip:p2site" { + org.eclipse.jetty.websocket.javax.server +} + +location "https://download.eclipse.org/gemini/updates/web/3.0.4" { + javax.websocket +} \ No newline at end of file