From 5e3d2fe419aad4236ddef3ec9bafdfe422bf008e Mon Sep 17 00:00:00 2001 From: U000805 Date: Tue, 20 Oct 2026 10:22:56 +0200 Subject: [PATCH] refactor: deprecate FastLazyURIEncoder because DefaultRuntimeModule enables index fragments (|N), which Xtext added in 2.7, where "|" was introduced as default cross-linking fragment separator. --- .../META-INF/MANIFEST.MF | 2 +- com.avaloq.tools.ddk.xtext.generator/pom.xml | 2 +- .../builder/BuilderIntegrationFragment2.java | 13 +++++-------- .../tools/ddk/xtext/linking/FastLazyURIEncoder.java | 7 +++++++ .../ddk/xtext/linking/LazyLinkingResource2.java | 5 ----- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF b/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF index 4fa27a2228..9fd111bf4e 100644 --- a/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF +++ b/com.avaloq.tools.ddk.xtext.generator/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: com.avaloq.tools.ddk.xtext.generator Bundle-SymbolicName: com.avaloq.tools.ddk.xtext.generator;singleton:=true -Bundle-Version: 17.3.3.qualifier +Bundle-Version: 17.3.4.qualifier Bundle-Vendor: Avaloq Group AG Bundle-RequiredExecutionEnvironment: JavaSE-21 Require-Bundle: org.eclipse.jface, diff --git a/com.avaloq.tools.ddk.xtext.generator/pom.xml b/com.avaloq.tools.ddk.xtext.generator/pom.xml index dd5ab4f8bc..526dbeed07 100644 --- a/com.avaloq.tools.ddk.xtext.generator/pom.xml +++ b/com.avaloq.tools.ddk.xtext.generator/pom.xml @@ -6,7 +6,7 @@ 18.0.1-SNAPSHOT ../ddk-parent - 17.3.3-SNAPSHOT + 17.3.4-SNAPSHOT com.avaloq.tools.ddk com.avaloq.tools.ddk.xtext.generator eclipse-plugin diff --git a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/builder/BuilderIntegrationFragment2.java b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/builder/BuilderIntegrationFragment2.java index 7caec249e0..6bf2818206 100644 --- a/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/builder/BuilderIntegrationFragment2.java +++ b/com.avaloq.tools.ddk.xtext.generator/src/com/avaloq/tools/ddk/xtext/generator/builder/BuilderIntegrationFragment2.java @@ -13,14 +13,12 @@ import org.eclipse.xtend2.lib.StringConcatenationClient; import org.eclipse.xtext.linking.lazy.LazyLinkingResource; -import org.eclipse.xtext.linking.lazy.LazyURIEncoder; import org.eclipse.xtext.resource.IContainer; import org.eclipse.xtext.resource.IResourceDescriptions; import org.eclipse.xtext.resource.impl.ResourceDescriptionsProvider; import org.eclipse.xtext.xtext.generator.model.GuiceModuleAccess; import org.eclipse.xtext.xtext.generator.model.TypeReference; -import com.avaloq.tools.ddk.xtext.linking.FastLazyURIEncoder; import com.avaloq.tools.ddk.xtext.linking.LazyLinkingResource2; import com.google.inject.name.Names; @@ -36,10 +34,9 @@ public class BuilderIntegrationFragment2 extends org.eclipse.xtext.xtext.generat @Override protected void addRuntimeGuiceBindings() { super.addRuntimeGuiceBindings(); - new GuiceModuleAccess.BindingFactory() - .addTypeToType(TypeReference.typeRef(IContainer.Manager.class), new TypeReference("com.avaloq.tools.ddk.xtext.builder.CachingStateBasedContainerManager")) - .addTypeToType(TypeReference.typeRef(LazyLinkingResource.class), TypeReference.typeRef(LazyLinkingResource2.class)) - .addTypeToType(TypeReference.typeRef(LazyURIEncoder.class), TypeReference.typeRef(FastLazyURIEncoder.class)) + new GuiceModuleAccess.BindingFactory()// + .addTypeToType(TypeReference.typeRef(IContainer.Manager.class), new TypeReference("com.avaloq.tools.ddk.xtext.builder.CachingStateBasedContainerManager"))// + .addTypeToType(TypeReference.typeRef(LazyLinkingResource.class), TypeReference.typeRef(LazyLinkingResource2.class))// .contributeTo(getLanguage().getRuntimeGenModule()); if (getProjectConfig().getRuntime().getManifest() != null) { getProjectConfig().getRuntime().getManifest().getRequiredBundles().add(BUILDER_BUNDLE_NAME); @@ -68,8 +65,8 @@ protected void appendTo(final TargetStringConcatenation target) { target.newLineIfNotEmpty(); } }; - new GuiceModuleAccess.BindingFactory() - .addConfiguredBinding(IResourceDescriptions.class.getSimpleName() + "BuilderScope", statement1) + new GuiceModuleAccess.BindingFactory()// + .addConfiguredBinding(IResourceDescriptions.class.getSimpleName() + "BuilderScope", statement1)// .contributeTo(getLanguage().getEclipsePluginGenModule()); if (getProjectConfig().getEclipsePlugin().getManifest() != null) { getProjectConfig().getEclipsePlugin().getManifest().getRequiredBundles().add(BUILDER_BUNDLE_NAME); diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/FastLazyURIEncoder.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/FastLazyURIEncoder.java index cbc922166d..15cde5180c 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/FastLazyURIEncoder.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/FastLazyURIEncoder.java @@ -24,12 +24,16 @@ /** * Optimized implementation of the LazyURIEncoder which uses custom string splitting logic. + *

+ * Note: Instead use the {@code LazyURIEncoder} */ +@Deprecated(forRemoval = true) public class FastLazyURIEncoder extends LazyURIEncoder { private static final String SEP = "::"; //$NON-NLS-1$ private static final int DECODE_START_IDX = 12; + @Deprecated(forRemoval = true) @Override public Triple decode(final Resource res, final String uriFragment) { if (isUseIndexFragment(res)) { @@ -61,13 +65,16 @@ public Triple decode(final Resource res, final Strin * The exception is thrown when decoding fails catastrophically. It is caught in LazyLinkingResource2.getEObject(). * See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=378088 */ + @Deprecated(forRemoval = true) @SuppressWarnings({"serial", "PMD.DoNotExtendJavaLangError"}) public static class DecodingError extends Error { + @Deprecated(forRemoval = true) public DecodingError(final RuntimeException cause) { super(cause); } + @Deprecated(forRemoval = true) @Override public RuntimeException getCause() { return (RuntimeException) super.getCause(); diff --git a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LazyLinkingResource2.java b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LazyLinkingResource2.java index 538a7c4500..1f814d32c0 100644 --- a/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LazyLinkingResource2.java +++ b/com.avaloq.tools.ddk.xtext/src/com/avaloq/tools/ddk/xtext/linking/LazyLinkingResource2.java @@ -28,7 +28,6 @@ import org.eclipse.emf.ecore.EReference; import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.util.EcoreUtil; -import org.eclipse.xtext.diagnostics.ExceptionDiagnostic; import org.eclipse.xtext.nodemodel.INode; import org.eclipse.xtext.nodemodel.serialization.SerializationUtil; import org.eclipse.xtext.parser.IParser; @@ -161,10 +160,6 @@ public synchronized EObject getEObject(final String uriFragment) { } } return result; - } catch (FastLazyURIEncoder.DecodingError err) { - RuntimeException cause = err.getCause(); - getErrors().add(new ExceptionDiagnostic(cause)); - throw new WrappedException(cause); // NOPMD PreserveStackTrace - intentional unwrap of DecodingError transport wrapper } catch (WrappedException e) { boolean logged = false; try {