From 07a84dacc10845aff9b521d344e620aa13ec888e Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 6 Dec 2024 08:37:57 -0500 Subject: [PATCH] Copy over eclipse/lsp4mp#480 into qute.jdt Use the secondary-type search for types in the project, and if that fails, use the non-secondary type search for types. Signed-off-by: David Thompson --- .../java/com/redhat/qute/jdt/utils/JDTTypeUtils.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qute.jdt/com.redhat.qute.jdt/src/main/java/com/redhat/qute/jdt/utils/JDTTypeUtils.java b/qute.jdt/com.redhat.qute.jdt/src/main/java/com/redhat/qute/jdt/utils/JDTTypeUtils.java index 06ffc77d0..54d6b9e7c 100644 --- a/qute.jdt/com.redhat.qute.jdt/src/main/java/com/redhat/qute/jdt/utils/JDTTypeUtils.java +++ b/qute.jdt/com.redhat.qute.jdt/src/main/java/com/redhat/qute/jdt/utils/JDTTypeUtils.java @@ -49,7 +49,14 @@ public static String getSimpleClassName(String className) { public static IType findType(IJavaProject project, String className) { try { - return project.findType(className, new NullProgressMonitor()); + IType type = project.findType(className, new NullProgressMonitor()); + if (type != null && type.exists()) { + return type; + } + } catch (JavaModelException e) { + } + try { + return project.findType(className); } catch (JavaModelException e) { LOGGER.log(Level.SEVERE, "Error while finding type for '" + className + "'.", e); return null;