From 6b53bf4250c8412380003f04f4035f05a38f3554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Kubitz?= Date: Tue, 12 Nov 2024 11:22:53 +0100 Subject: [PATCH] Downgrade ReadOnly Exception to warning Throwing an Exception here currently causes more pain then just continuing. Ideally one would rework the getter JavaProject.getResolvedClasspath() to never modify the javamodel, but it's not clear how todo that in a compatible way. https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/1742 --- .../model/org/eclipse/jdt/internal/core/DeltaProcessor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java index 8505d77d241..f62651f5ecf 100644 --- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java +++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/DeltaProcessor.java @@ -30,6 +30,7 @@ import java.util.Set; import org.eclipse.core.resources.*; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.ILog; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.ISafeRunnable; @@ -2022,7 +2023,9 @@ public void resetProjectCaches() { */ public void registerJavaModelDelta(IJavaElementDelta delta) { if (JavaModelManager.isReadOnly()) { - throw new IllegalStateException("Its not allow to modify JavaModel during ReadOnly action. delta=" + delta); //$NON-NLS-1$ + ILog.get().warn("JavaModel change during read only operation", new IllegalStateException( //$NON-NLS-1$ + "JavaModel modified during 'read only' operation. Consider to report this warning to https://github.com/eclipse-jdt/eclipse.jdt.core/issues. delta=" //$NON-NLS-1$ + + delta)); } this.javaModelDeltas.add(delta); }