Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fix checkstyle issues
Signed-off-by: Thomas Mäder <t.s.maeder@gmail.com>
  • Loading branch information
tsmaeder committed Nov 3, 2025
commit b3e14c054eba0bf65bc8b33d4301eda1153baf9f
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,16 @@ public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught
}

@Override
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters) {
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, null, classFilters, classExclusionFilters);
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters) {
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, null,
classFilters, classExclusionFilters);
}

@Override
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes,
String[] classFilters, String[] classExclusionFilters) {
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
int suspendModeOnUncaught, String[] exceptionTypes,
String[] classFilters, String[] classExclusionFilters) {
EventRequestManager manager = vm.eventRequestManager();

try {
Expand All @@ -173,7 +176,8 @@ public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught
subscriptions.clear();
eventRequests.clear();

// When no exception breakpoints are requested, no need to create an empty exception request.
// When no exception breakpoints are requested, no need to create an empty
// exception request.
if (notifyCaught || notifyUncaught) {
// from: https://www.javatips.net/api/REPLmode-master/src/jm/mode/replmode/REPLRunner.java
// Calling this seems to set something internally to make the
Expand All @@ -188,7 +192,8 @@ public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught
// See org.eclipse.debug.jdi.tests.AbstractJDITest for the example.

if (exceptionTypes == null || exceptionTypes.length == 0) {
createExceptionBreakpoint(null, notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
createExceptionBreakpoint(null, notifyCaught, notifyUncaught, suspendModeOnCaught,
suspendModeOnUncaught, classFilters, classExclusionFilters);
return;
}

Expand All @@ -204,31 +209,36 @@ public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught
eventRequests.add(classPrepareRequest);

Disposable subscription = eventHub.events()
.filter(debugEvent -> debugEvent.event instanceof ClassPrepareEvent
&& eventRequests.contains(debugEvent.event.request()))
.subscribe(debugEvent -> {
ClassPrepareEvent event = (ClassPrepareEvent) debugEvent.event;
createExceptionBreakpoint(event.referenceType(), notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
});
.filter(debugEvent -> debugEvent.event instanceof ClassPrepareEvent
&& eventRequests.contains(debugEvent.event.request()))
.subscribe(debugEvent -> {
ClassPrepareEvent event = (ClassPrepareEvent) debugEvent.event;
createExceptionBreakpoint(event.referenceType(), notifyCaught, notifyUncaught,
suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
});
subscriptions.add(subscription);

// register exception breakpoint in the loaded classes.
for (ReferenceType refType : vm.classesByName(exceptionType)) {
createExceptionBreakpoint(refType, notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
createExceptionBreakpoint(refType, notifyCaught, notifyUncaught, suspendModeOnCaught,
suspendModeOnUncaught, classFilters, classExclusionFilters);
}
}
}
}

@Override
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes,
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
int suspendModeOnUncaught, String[] exceptionTypes,
String[] classFilters, String[] classExclusionFilters, boolean async) {
if (async) {
AsyncJdwpUtils.runAsync(() -> {
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, exceptionTypes, classFilters, classExclusionFilters);
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught,
exceptionTypes, classFilters, classExclusionFilters);
});
} else {
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, exceptionTypes, classFilters, classExclusionFilters);
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught,
exceptionTypes, classFilters, classExclusionFilters);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,25 @@ public interface IDebugSession {
void terminate();

// breakpoints
IBreakpoint createBreakpoint(String className, int lineNumber, int hitCount, String condition, String logMessage, int suspendPolicy);
IBreakpoint createBreakpoint(String className, int lineNumber, int hitCount, String condition, String logMessage,
int suspendPolicy);

IBreakpoint createBreakpoint(JavaBreakpointLocation sourceLocation, int hitCount, String condition, String logMessage, int suspendPolicy);
IBreakpoint createBreakpoint(JavaBreakpointLocation sourceLocation, int hitCount, String condition,
String logMessage, int suspendPolicy);

IWatchpoint createWatchPoint(String className, String fieldName, String accessType, String condition, int hitCount);

void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught);
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
int suspendModeOnUncaught);

void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters);
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters);

void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters);
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters);

void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters,
boolean async);
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters, boolean async);

IMethodBreakpoint createFunctionBreakpoint(String className, String functionName, String condition, int hitCount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public final class Constants {
public static final String PROJECT_NAME = "projectName";
public static final String DEBUGGEE_ENCODING = "debuggeeEncoding";
public static final String MAIN_CLASS = "mainClass";

// Breakpoint suspend modes
public static final String SUSPEND_VM = "suspendVM";
public static final String SUSPEND_THREAD = "suspendThread";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,30 +68,27 @@ public CompletableFuture<Messages.Response> handle(Requests.Command command, Req
caps.supportsClipboardContext = true;
caps.supportsBreakpointLocationsRequest = true;
caps.supportsStepInTargetsRequest = true;

// Add breakpoint modes for suspend behavior
Types.BreakpointMode[] breakpointModes = {
new Types.BreakpointMode (
Constants.SUSPEND_THREAD,
"Suspend Thread",
"Suspends only the thread that hit the breakpoint",
new Types.BreakpointModeApplicability[] {
Types.BreakpointModeApplicability.SOURCE
// data and function breakpoints are not supported by VS Code
// instruction breakpoints are not supported by this adapter
}
),
new Types.BreakpointMode(
Constants.SUSPEND_VM,
"Suspend VM",
"Suspends the entire virtual machine when breakpoint is hit",
new Types.BreakpointModeApplicability[] {
Types.BreakpointModeApplicability.SOURCE }
)

new Types.BreakpointMode(
Constants.SUSPEND_THREAD,
"Suspend Thread",
"Suspends only the thread that hit the breakpoint",
new Types.BreakpointModeApplicability[] {
Types.BreakpointModeApplicability.SOURCE
// data and function breakpoints are not supported by VS Code
// instruction breakpoints are not supported by this adapter
}),
new Types.BreakpointMode(
Constants.SUSPEND_VM,
"Suspend VM",
"Suspends the entire virtual machine when breakpoint is hit",
new Types.BreakpointModeApplicability[] {
Types.BreakpointModeApplicability.SOURCE })
};
caps.breakpointModes = breakpointModes;

response.body = caps;
context.setInitialized(true);
return CompletableFuture.completedFuture(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
}
});
}
SetExceptionBreakpointsArguments requestArgs = (SetExceptionBreakpointsArguments)arguments;

SetExceptionBreakpointsArguments requestArgs = (SetExceptionBreakpointsArguments) arguments;
String[] filters = requestArgs.filters;

try {
Expand All @@ -82,7 +82,7 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
}
this.suspendModeOnCaught = EventRequest.SUSPEND_EVENT_THREAD;
this.suspendModeOnUncaught = EventRequest.SUSPEND_EVENT_THREAD;

ExceptionFilterOptions[] filterOptions = requestArgs.filterOptions;
if (filterOptions != null) {
for (ExceptionFilterOptions filterOption : requestArgs.filterOptions) {
Expand All @@ -94,7 +94,7 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
this.suspendModeOnUncaught = AdapterUtils.suspendPolicyFromBreakpointMode(filterOption.mode);
}
}
}
}
setExceptionBreakpoints(context.getDebugSession(), this.notifyCaught, this.notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught);
return CompletableFuture.completedFuture(response);
} catch (Exception ex) {
Expand All @@ -105,12 +105,14 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
}
}

private void setExceptionBreakpoints(IDebugSession debugSession, boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught) {
private void setExceptionBreakpoints(IDebugSession debugSession, boolean notifyCaught, boolean notifyUncaught,
int suspendModeOnCaught, int suspendModeOnUncaught) {
ExceptionFilters exceptionFilters = DebugSettings.getCurrent().exceptionFilters;
String[] exceptionTypes = (exceptionFilters == null ? null : exceptionFilters.exceptionTypes);
String[] classFilters = (exceptionFilters == null ? null : exceptionFilters.allowClasses);
String[] classExclusionFilters = (exceptionFilters == null ? null : exceptionFilters.skipClasses);
debugSession.setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, exceptionTypes, classFilters, classExclusionFilters, this.asyncJDWP);
debugSession.setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught,
exceptionTypes, classFilters, classExclusionFilters, this.asyncJDWP);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public static class SetExceptionBreakpointsArguments extends Arguments {
public ExceptionFilterOptions[] filterOptions;

/**
* Configuration options for selected exceptions. The attribute is only honored by a debug adapter if the corresponding capability `supportsExceptionOptions` is true.
* Configuration options for selected exceptions. The attribute is only honored by a debug adapter
* if the corresponding capability `supportsExceptionOptions` is true.
*/
public ExceptionOptions[] exceptionOptions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ public static class ExceptionPathSegment {
* If false or missing this segment matches the names provided, otherwise it matches anything except the names provided.
*/
public boolean negate;

/**
* Depending on the value of negate the names that should match or not match.
*/
Expand All @@ -457,7 +457,7 @@ public static class ExceptionOptions {
* By convention the first segment of the path is a category that is used to group exceptions in the UI.
*/
public ExceptionPathSegment[] path;

/**
* Condition when a thrown exception should result in a break.
*/
Expand All @@ -480,12 +480,12 @@ public static class ExceptionFilterOptions {
* ID of an exception filter returned by the exceptionBreakpointFilters capability.
*/
public String filterId;

/**
* An expression for conditional exceptions. The exception breaks into the debugger if the result of the condition is true.
*/
public String condition;

/**
* The mode of this exception breakpoint. If defined, this must be one of the breakpointModes the debug adapter advertised in its Capabilities.
*/
Expand Down Expand Up @@ -527,25 +527,24 @@ public BreakpointMode(String mode, String label, String description, BreakpointM
* The internal ID of the mode. This value is passed to the `setBreakpoints`
* request.
*/
public String mode;
public String mode;

/**
* The name of the breakpoint mode. This is shown in the UI.
*/
public String label;

/**
* A help text providing additional information about the breakpoint mode.
* This string is typically shown as a hover and can be translated.
*/
public String description;

/**
* Describes one or more type of breakpoint this mode applies to.
*/
public BreakpointModeApplicability[] appliesTo;
}

}

public static class Capabilities {
public boolean supportsConfigurationDoneRequest;
Expand Down
Loading