From 2ca513c25fde3c23bdee1969f7e6db97b5bfa89b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Wed, 23 Jul 2025 06:16:31 +0200 Subject: [PATCH] Do not return null from ClassFileEditorInputFactory when type not found Currently the ClassFileEditorInputFactory tries to update a stored element reference to a type in the project when it encounters an IOrdinaryClassFile. If that lookup fails (for whatever reason) it return null that results in a complete crash of the editor during restore as null is not a valid EditorInput. This now returns an InternalClassFileEditorInput instead to make it show the editor again after a restart. Fixes https://github.com/eclipse-jdt/eclipse.jdt.ui/issues/2371 --- .../jdt/internal/ui/javaeditor/ClassFileEditorInputFactory.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditorInputFactory.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditorInputFactory.java index f90146c7624..07f07fa9128 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditorInputFactory.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/ClassFileEditorInputFactory.java @@ -61,7 +61,7 @@ public IAdaptable createElement(IMemento memento) { if (project != null) { type= project.findType(type.getFullyQualifiedName()); if (type == null) - return null; + return new InternalClassFileEditorInput(cf); element= type.getParent(); } }