From a63e048a049be7e7cea6611178feaa974c3269d9 Mon Sep 17 00:00:00 2001 From: Mickael Istria Date: Tue, 24 Sep 2024 14:31:45 +0200 Subject: [PATCH] Do not crash on non-convertible type Log instead --- .../src/org/eclipse/jdt/core/dom/JavacConverter.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java index 85fd9bc7ec9..4f868f3cd25 100644 --- a/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java +++ b/org.eclipse.jdt.core.javac/src/org/eclipse/jdt/core/dom/JavacConverter.java @@ -3057,13 +3057,15 @@ Type convertToType(JCTree javac) { res.setFlags(ASTNode.RECOVERED); return res; } - throw new UnsupportedOperationException("Not supported yet, type " + javac + " of class" + javac.getClass()); + ILog.get().warn("Not supported yet, converting to type type " + javac + " of class" + javac.getClass()); + return null; } public static int ordinalIndexOf(String str, String substr, int n) { - int pos = str.indexOf(substr); - while (--n > 0 && pos != -1) - pos = str.indexOf(substr, pos + 1); - return pos; + int pos = str.indexOf(substr); + while (--n > 0 && pos != -1) { + pos = str.indexOf(substr, pos + 1); + } + return pos; } private Code convert(TypeKind javac) { return switch(javac) {