2828import static luceedebug .coreinject .Iife .iife ;
2929
3030import luceedebug .*;
31+ import luceedebug .StrongInt .DapBreakpointID ;
3132import luceedebug .StrongLong .JdwpThreadID ;
3233import luceedebug .StrongString .CanonicalServerAbsPath ;
3334import luceedebug .StrongString .RawIdePath ;
@@ -116,7 +117,7 @@ private static class ReplayableCfBreakpointRequest {
116117 final RawIdePath ideAbsPath ;
117118 final CanonicalServerAbsPath serverAbsPath ;
118119 final int line ;
119- final int id ;
120+ final DapBreakpointID id ;
120121 /**
121122 * expression for conditional breakpoints
122123 * can be null for "not a conditional breakpoint"
@@ -144,7 +145,7 @@ public boolean equals(Object vv) {
144145 && expr .equals (v .expr );
145146 }
146147
147- ReplayableCfBreakpointRequest (RawIdePath ideAbsPath , CanonicalServerAbsPath serverAbsPath , int line , int id , String expr ) {
148+ ReplayableCfBreakpointRequest (RawIdePath ideAbsPath , CanonicalServerAbsPath serverAbsPath , int line , DapBreakpointID id , String expr ) {
148149 this .ideAbsPath = ideAbsPath ;
149150 this .serverAbsPath = serverAbsPath ;
150151 this .line = line ;
@@ -153,7 +154,7 @@ public boolean equals(Object vv) {
153154 this .maybeNull_jdwpBreakpointRequest = null ;
154155 }
155156
156- ReplayableCfBreakpointRequest (RawIdePath ideAbsPath , CanonicalServerAbsPath serverAbsPath , int line , int id , String expr , BreakpointRequest jdwpBreakpointRequest ) {
157+ ReplayableCfBreakpointRequest (RawIdePath ideAbsPath , CanonicalServerAbsPath serverAbsPath , int line , DapBreakpointID id , String expr , BreakpointRequest jdwpBreakpointRequest ) {
157158 this .ideAbsPath = ideAbsPath ;
158159 this .serverAbsPath = serverAbsPath ;
159160 this .line = line ;
@@ -471,14 +472,14 @@ public LuceeVm(Config config, VirtualMachine vm) {
471472 private static enum SteppingState { stepping , finalizingViaAwaitedBreakpoint }
472473 private ConcurrentMap <JdwpThreadID , SteppingState > steppingStatesByThread = new ConcurrentHashMap <>();
473474 private Consumer <JdwpThreadID > stepEventCallback = null ;
474- private BiConsumer <JdwpThreadID , /*breakpoint ID*/ Integer > breakpointEventCallback = null ;
475+ private BiConsumer <JdwpThreadID , DapBreakpointID > breakpointEventCallback = null ;
475476 private Consumer <BreakpointsChangedEvent > breakpointsChangedCallback = null ;
476477
477478 public void registerStepEventCallback (Consumer <JdwpThreadID > cb ) {
478479 stepEventCallback = cb ;
479480 }
480481
481- public void registerBreakpointEventCallback (BiConsumer <JdwpThreadID , Integer > cb ) {
482+ public void registerBreakpointEventCallback (BiConsumer <JdwpThreadID , DapBreakpointID > cb ) {
482483 breakpointEventCallback = cb ;
483484 }
484485
@@ -690,7 +691,7 @@ private void handleBreakpointEvent(BreakpointEvent event) {
690691 }
691692
692693 if (breakpointEventCallback != null ) {
693- final var bpID = (Integer ) request .getProperty (LUCEEDEBUG_BREAKPOINT_ID );
694+ final var bpID = (DapBreakpointID ) request .getProperty (LUCEEDEBUG_BREAKPOINT_ID );
694695 breakpointEventCallback .accept (threadID , bpID );
695696 }
696697 }
@@ -727,8 +728,8 @@ public IDebugEntity[] getIndexedVariables(long ID) {
727728 }
728729
729730 private AtomicInteger breakpointID = new AtomicInteger ();
730- private int nextBreakpointID () {
731- return breakpointID .incrementAndGet ();
731+ private DapBreakpointID nextDapBreakpointID () {
732+ return new DapBreakpointID ( breakpointID .incrementAndGet () );
732733 }
733734
734735 public void rebindBreakpoints (CanonicalServerAbsPath serverAbsPath , Collection <ReplayableCfBreakpointRequest > cfBpRequests ) {
@@ -743,10 +744,10 @@ static class BpLineAndId {
743744 final RawIdePath ideAbsPath ;
744745 final CanonicalServerAbsPath serverAbsPath ;
745746 final int line ;
746- final int id ;
747+ final DapBreakpointID id ;
747748 final String expr ;
748749
749- public BpLineAndId (RawIdePath ideAbsPath , CanonicalServerAbsPath serverAbsPath , int line , int id , String expr ) {
750+ public BpLineAndId (RawIdePath ideAbsPath , CanonicalServerAbsPath serverAbsPath , int line , DapBreakpointID id , String expr ) {
750751 this .ideAbsPath = ideAbsPath ;
751752 this .serverAbsPath = serverAbsPath ;
752753 this .line = line ;
@@ -767,16 +768,16 @@ private BpLineAndId[] freshBpLineAndIdRecordsFromLines(RawIdePath idePath, Canon
767768 for (var i = 0 ; i < lines .length ; ++i ) {
768769 final int line = lines [i ];
769770
770- int id = iife (() -> {
771+ DapBreakpointID id = iife (() -> {
771772 if (bpInfo == null ) {
772- return nextBreakpointID ();
773+ return nextDapBreakpointID ();
773774 }
774775 for (var z : bpInfo ) {
775776 if (z .line == line ) {
776777 return z .id ;
777778 }
778779 }
779- return nextBreakpointID ();
780+ return nextDapBreakpointID ();
780781 });
781782
782783 result [i ] = new BpLineAndId (idePath , serverPath , line , id , exprs [i ]);
0 commit comments