diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java index fc818944..af9cdbc5 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainClassHandler.java @@ -241,6 +241,13 @@ private boolean isMainMethod(IMethod method) { return method.isMainMethod(); } catch (JavaModelException e) { // do nothing + } catch (NoSuchMethodError e) { + // isMainMethodCandidate() was added in JDT Core 3.36, fall back to isMainMethod() + try { + return method.isMainMethod(); + } catch (JavaModelException ex) { + // do nothing + } } return false; diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainMethodHandler.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainMethodHandler.java index be1092bb..820bddd5 100644 --- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainMethodHandler.java +++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/ResolveMainMethodHandler.java @@ -112,9 +112,13 @@ public static IMethod getMainMethod(IType type) throws JavaModelException { boolean allowInstanceMethod = isInstanceMainMethodSupported(type); List methods = new ArrayList<>(); for (IMethod method : type.getMethods()) { - if (method instanceof SourceMethod - && ((SourceMethod) method).isMainMethodCandidate()) { - methods.add(method); + try { + if (method instanceof SourceMethod + && ((SourceMethod) method).isMainMethodCandidate()) { + methods.add(method); + } + } catch (NoSuchMethodError e) { + // isMainMethodCandidate() was added in JDT Core 3.36, skip if unavailable } if (method.isMainMethod()) {