-
Notifications
You must be signed in to change notification settings - Fork 411
Closed
microsoft/java-debug
#522Labels
Description
Having a method taking multiple lambdas(i.e. just good ol' java Consumer) and calling those with inline lambdas a breakpoint only works on a last one. Taking lambda out or using null makes breakpoints to work.
Environment
- Operating System: Linux (ubuntu 18.04)
- JDK version: 17
- Visual Studio Code version: 1.82.2
- Java extension version: 1.24.0
- Java Debugger extension version: 0.55.0
Steps To Reproduce
Copy this test class and add breakpoints to println calls and testMethod* calls.
package com.example.demo;
import java.util.function.Consumer;
import org.junit.jupiter.api.Test;
class BreakpointTests {
static void testMethod1(Consumer<String> consumer1, Consumer<String> consumer2) {
if (consumer1 != null) {
consumer1.accept("hi");
}
if (consumer2 != null) {
consumer2.accept("hi");
}
}
@Test
void test1() {
testMethod1(
s1 -> {
// breakpoint doesn't work
// shows "unverified breakpoint"
System.out.println("hi");
},
s2 -> {
// breakpoint works
System.out.println("hi");
}
);
}
@Test
void test2() {
testMethod1(
s1 -> {
// breakpoint works
System.out.println("hi");
},
null
);
}
@Test
void test3() {
Consumer<String> consumer2 = s -> {
// breakpoint works
System.out.println("hi");
};
testMethod1(
s1 -> {
// breakpoint works
System.out.println("hi");
},
consumer2
);
}
static void testMethod2(Consumer<String> consumer1, Consumer<String> consumer2, Consumer<String> consumer3) {
if (consumer1 != null) {
consumer1.accept("hi");
}
if (consumer2 != null) {
consumer2.accept("hi");
}
if (consumer3 != null) {
consumer3.accept("hi");
}
}
@Test
void test4() {
testMethod2(
s1 -> {
// breakpoint doesn't work
// shows "unverified breakpoint"
System.out.println("hi");
},
s2 -> {
// breakpoint doesn't work
// shows "unverified breakpoint"
System.out.println("hi");
},
s3 -> {
// breakpoint works
System.out.println("hi");
}
);
}
}
tzolov