Skip to content

Commit b3e14c0

Browse files
committed
Fix checkstyle issues
Signed-off-by: Thomas Mäder <[email protected]>
1 parent 86c69d7 commit b3e14c0

File tree

7 files changed

+75
-61
lines changed

7 files changed

+75
-61
lines changed

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/DebugSession.java

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,16 @@ public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught
151151
}
152152

153153
@Override
154-
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters) {
155-
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, null, classFilters, classExclusionFilters);
154+
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
155+
int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters) {
156+
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, null,
157+
classFilters, classExclusionFilters);
156158
}
157159

158160
@Override
159-
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes,
160-
String[] classFilters, String[] classExclusionFilters) {
161+
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
162+
int suspendModeOnUncaught, String[] exceptionTypes,
163+
String[] classFilters, String[] classExclusionFilters) {
161164
EventRequestManager manager = vm.eventRequestManager();
162165

163166
try {
@@ -173,7 +176,8 @@ public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught
173176
subscriptions.clear();
174177
eventRequests.clear();
175178

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

190194
if (exceptionTypes == null || exceptionTypes.length == 0) {
191-
createExceptionBreakpoint(null, notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
195+
createExceptionBreakpoint(null, notifyCaught, notifyUncaught, suspendModeOnCaught,
196+
suspendModeOnUncaught, classFilters, classExclusionFilters);
192197
return;
193198
}
194199

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

206211
Disposable subscription = eventHub.events()
207-
.filter(debugEvent -> debugEvent.event instanceof ClassPrepareEvent
208-
&& eventRequests.contains(debugEvent.event.request()))
209-
.subscribe(debugEvent -> {
210-
ClassPrepareEvent event = (ClassPrepareEvent) debugEvent.event;
211-
createExceptionBreakpoint(event.referenceType(), notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
212-
});
212+
.filter(debugEvent -> debugEvent.event instanceof ClassPrepareEvent
213+
&& eventRequests.contains(debugEvent.event.request()))
214+
.subscribe(debugEvent -> {
215+
ClassPrepareEvent event = (ClassPrepareEvent) debugEvent.event;
216+
createExceptionBreakpoint(event.referenceType(), notifyCaught, notifyUncaught,
217+
suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
218+
});
213219
subscriptions.add(subscription);
214220

215221
// register exception breakpoint in the loaded classes.
216222
for (ReferenceType refType : vm.classesByName(exceptionType)) {
217-
createExceptionBreakpoint(refType, notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, classFilters, classExclusionFilters);
223+
createExceptionBreakpoint(refType, notifyCaught, notifyUncaught, suspendModeOnCaught,
224+
suspendModeOnUncaught, classFilters, classExclusionFilters);
218225
}
219226
}
220227
}
221228
}
222229

223230
@Override
224-
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes,
231+
public void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
232+
int suspendModeOnUncaught, String[] exceptionTypes,
225233
String[] classFilters, String[] classExclusionFilters, boolean async) {
226234
if (async) {
227235
AsyncJdwpUtils.runAsync(() -> {
228-
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, exceptionTypes, classFilters, classExclusionFilters);
236+
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught,
237+
exceptionTypes, classFilters, classExclusionFilters);
229238
});
230239
} else {
231-
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, exceptionTypes, classFilters, classExclusionFilters);
240+
setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught,
241+
exceptionTypes, classFilters, classExclusionFilters);
232242
}
233243
}
234244

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/IDebugSession.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,25 @@ public interface IDebugSession {
2828
void terminate();
2929

3030
// breakpoints
31-
IBreakpoint createBreakpoint(String className, int lineNumber, int hitCount, String condition, String logMessage, int suspendPolicy);
31+
IBreakpoint createBreakpoint(String className, int lineNumber, int hitCount, String condition, String logMessage,
32+
int suspendPolicy);
3233

33-
IBreakpoint createBreakpoint(JavaBreakpointLocation sourceLocation, int hitCount, String condition, String logMessage, int suspendPolicy);
34+
IBreakpoint createBreakpoint(JavaBreakpointLocation sourceLocation, int hitCount, String condition,
35+
String logMessage, int suspendPolicy);
3436

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

37-
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught);
39+
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
40+
int suspendModeOnUncaught);
3841

39-
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters);
42+
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
43+
int suspendModeOnUncaught, String[] classFilters, String[] classExclusionFilters);
4044

41-
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters);
45+
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
46+
int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters);
4247

43-
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters,
44-
boolean async);
48+
void setExceptionBreakpoints(boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught,
49+
int suspendModeOnUncaught, String[] exceptionTypes, String[] classFilters, String[] classExclusionFilters, boolean async);
4550

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

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/Constants.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public final class Constants {
1515
public static final String PROJECT_NAME = "projectName";
1616
public static final String DEBUGGEE_ENCODING = "debuggeeEncoding";
1717
public static final String MAIN_CLASS = "mainClass";
18-
18+
1919
// Breakpoint suspend modes
2020
public static final String SUSPEND_VM = "suspendVM";
2121
public static final String SUSPEND_THREAD = "suspendThread";

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/InitializeRequestHandler.java

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,30 +68,27 @@ public CompletableFuture<Messages.Response> handle(Requests.Command command, Req
6868
caps.supportsClipboardContext = true;
6969
caps.supportsBreakpointLocationsRequest = true;
7070
caps.supportsStepInTargetsRequest = true;
71-
71+
7272
// Add breakpoint modes for suspend behavior
7373
Types.BreakpointMode[] breakpointModes = {
74-
new Types.BreakpointMode (
75-
Constants.SUSPEND_THREAD,
76-
"Suspend Thread",
77-
"Suspends only the thread that hit the breakpoint",
78-
new Types.BreakpointModeApplicability[] {
79-
Types.BreakpointModeApplicability.SOURCE
80-
// data and function breakpoints are not supported by VS Code
81-
// instruction breakpoints are not supported by this adapter
82-
}
83-
),
84-
new Types.BreakpointMode(
85-
Constants.SUSPEND_VM,
86-
"Suspend VM",
87-
"Suspends the entire virtual machine when breakpoint is hit",
88-
new Types.BreakpointModeApplicability[] {
89-
Types.BreakpointModeApplicability.SOURCE }
90-
)
91-
74+
new Types.BreakpointMode(
75+
Constants.SUSPEND_THREAD,
76+
"Suspend Thread",
77+
"Suspends only the thread that hit the breakpoint",
78+
new Types.BreakpointModeApplicability[] {
79+
Types.BreakpointModeApplicability.SOURCE
80+
// data and function breakpoints are not supported by VS Code
81+
// instruction breakpoints are not supported by this adapter
82+
}),
83+
new Types.BreakpointMode(
84+
Constants.SUSPEND_VM,
85+
"Suspend VM",
86+
"Suspends the entire virtual machine when breakpoint is hit",
87+
new Types.BreakpointModeApplicability[] {
88+
Types.BreakpointModeApplicability.SOURCE })
9289
};
9390
caps.breakpointModes = breakpointModes;
94-
91+
9592
response.body = caps;
9693
context.setInitialized(true);
9794
return CompletableFuture.completedFuture(response);

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/adapter/handler/SetExceptionBreakpointsRequestHandler.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
6464
}
6565
});
6666
}
67-
68-
SetExceptionBreakpointsArguments requestArgs = (SetExceptionBreakpointsArguments)arguments;
67+
68+
SetExceptionBreakpointsArguments requestArgs = (SetExceptionBreakpointsArguments) arguments;
6969
String[] filters = requestArgs.filters;
7070

7171
try {
@@ -82,7 +82,7 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
8282
}
8383
this.suspendModeOnCaught = EventRequest.SUSPEND_EVENT_THREAD;
8484
this.suspendModeOnUncaught = EventRequest.SUSPEND_EVENT_THREAD;
85-
85+
8686
ExceptionFilterOptions[] filterOptions = requestArgs.filterOptions;
8787
if (filterOptions != null) {
8888
for (ExceptionFilterOptions filterOption : requestArgs.filterOptions) {
@@ -94,7 +94,7 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
9494
this.suspendModeOnUncaught = AdapterUtils.suspendPolicyFromBreakpointMode(filterOption.mode);
9595
}
9696
}
97-
}
97+
}
9898
setExceptionBreakpoints(context.getDebugSession(), this.notifyCaught, this.notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught);
9999
return CompletableFuture.completedFuture(response);
100100
} catch (Exception ex) {
@@ -105,12 +105,14 @@ public synchronized CompletableFuture<Response> handle(Command command, Argument
105105
}
106106
}
107107

108-
private void setExceptionBreakpoints(IDebugSession debugSession, boolean notifyCaught, boolean notifyUncaught, int suspendModeOnCaught, int suspendModeOnUncaught) {
108+
private void setExceptionBreakpoints(IDebugSession debugSession, boolean notifyCaught, boolean notifyUncaught,
109+
int suspendModeOnCaught, int suspendModeOnUncaught) {
109110
ExceptionFilters exceptionFilters = DebugSettings.getCurrent().exceptionFilters;
110111
String[] exceptionTypes = (exceptionFilters == null ? null : exceptionFilters.exceptionTypes);
111112
String[] classFilters = (exceptionFilters == null ? null : exceptionFilters.allowClasses);
112113
String[] classExclusionFilters = (exceptionFilters == null ? null : exceptionFilters.skipClasses);
113-
debugSession.setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught, exceptionTypes, classFilters, classExclusionFilters, this.asyncJDWP);
114+
debugSession.setExceptionBreakpoints(notifyCaught, notifyUncaught, suspendModeOnCaught, suspendModeOnUncaught,
115+
exceptionTypes, classFilters, classExclusionFilters, this.asyncJDWP);
114116
}
115117

116118
@Override

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/protocol/Requests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,8 @@ public static class SetExceptionBreakpointsArguments extends Arguments {
262262
public ExceptionFilterOptions[] filterOptions;
263263

264264
/**
265-
* Configuration options for selected exceptions. The attribute is only honored by a debug adapter if the corresponding capability `supportsExceptionOptions` is true.
265+
* Configuration options for selected exceptions. The attribute is only honored by a debug adapter
266+
* if the corresponding capability `supportsExceptionOptions` is true.
266267
*/
267268
public ExceptionOptions[] exceptionOptions;
268269
}

com.microsoft.java.debug.core/src/main/java/com/microsoft/java/debug/core/protocol/Types.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public static class ExceptionPathSegment {
433433
* If false or missing this segment matches the names provided, otherwise it matches anything except the names provided.
434434
*/
435435
public boolean negate;
436-
436+
437437
/**
438438
* Depending on the value of negate the names that should match or not match.
439439
*/
@@ -457,7 +457,7 @@ public static class ExceptionOptions {
457457
* By convention the first segment of the path is a category that is used to group exceptions in the UI.
458458
*/
459459
public ExceptionPathSegment[] path;
460-
460+
461461
/**
462462
* Condition when a thrown exception should result in a break.
463463
*/
@@ -480,12 +480,12 @@ public static class ExceptionFilterOptions {
480480
* ID of an exception filter returned by the exceptionBreakpointFilters capability.
481481
*/
482482
public String filterId;
483-
483+
484484
/**
485485
* An expression for conditional exceptions. The exception breaks into the debugger if the result of the condition is true.
486486
*/
487487
public String condition;
488-
488+
489489
/**
490490
* The mode of this exception breakpoint. If defined, this must be one of the breakpointModes the debug adapter advertised in its Capabilities.
491491
*/
@@ -527,25 +527,24 @@ public BreakpointMode(String mode, String label, String description, BreakpointM
527527
* The internal ID of the mode. This value is passed to the `setBreakpoints`
528528
* request.
529529
*/
530-
public String mode;
531-
530+
public String mode;
531+
532532
/**
533533
* The name of the breakpoint mode. This is shown in the UI.
534534
*/
535535
public String label;
536-
536+
537537
/**
538538
* A help text providing additional information about the breakpoint mode.
539539
* This string is typically shown as a hover and can be translated.
540540
*/
541541
public String description;
542-
542+
543543
/**
544544
* Describes one or more type of breakpoint this mode applies to.
545545
*/
546546
public BreakpointModeApplicability[] appliesTo;
547-
}
548-
547+
}
549548

550549
public static class Capabilities {
551550
public boolean supportsConfigurationDoneRequest;

0 commit comments

Comments
 (0)