Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Comment thread
wenytang-ms marked this conversation as resolved.
// do nothing
}
}

return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,13 @@ public static IMethod getMainMethod(IType type) throws JavaModelException {
boolean allowInstanceMethod = isInstanceMainMethodSupported(type);
List<IMethod> 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
Comment thread
wenytang-ms marked this conversation as resolved.
}

if (method.isMainMethod()) {
Expand Down
Loading