From 9c2503a59a256a67aba7f31b9eda03c6cf7b174e Mon Sep 17 00:00:00 2001 From: Tobias Ortmayr Date: Wed, 28 Aug 2024 09:54:16 +0200 Subject: [PATCH] Fix wrong precondition --- .../src/org/eclipse/glsp/server/di/ServerModule.java | 2 +- .../src/org/eclipse/glsp/server/utils/BiIndex.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/ServerModule.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/ServerModule.java index fcdf5292..3fe57e37 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/ServerModule.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/di/ServerModule.java @@ -86,7 +86,7 @@ public class ServerModule extends GLSPModule { */ public ServerModule configureDiagramModule(final DiagramModule diagramModule, final Module... mixinModules) { String diagramType = diagramModule.getDiagramType(); - if (!diagramModules.containsKey(diagramType)) { + if (diagramModules.containsKey(diagramType)) { throw new IllegalArgumentException( "A module configuration is already present for diagram type: " + diagramType); } diff --git a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/BiIndex.java b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/BiIndex.java index c2ff95c2..832bf30b 100644 --- a/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/BiIndex.java +++ b/plugins/org.eclipse.glsp.server/src/org/eclipse/glsp/server/utils/BiIndex.java @@ -32,10 +32,16 @@ public class BiIndex { protected Map map = new HashMap<>(); protected Map inverseMap = new HashMap<>(); + /** + * Returns an unmodifiable map of the currently indexed key-value pairs. + */ public Map map() { return Map.copyOf(map); } + /** + * Returns an unmodifiable inversed map (value to key) of the currently indexed key-value pairs. + */ public Map inverseMap() { return Map.copyOf(inverseMap); }