Skip to content

Commit

Permalink
Downgrade ReadOnly Exception to warning
Browse files Browse the repository at this point in the history
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.

eclipse-jdt/eclipse.jdt.ui#1742
  • Loading branch information
EcljpseB0T authored and jukzi committed Nov 18, 2024
1 parent 74ec8f9 commit 6b53bf4
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 6b53bf4

Please sign in to comment.