diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java
index b14afde8..97581242 100644
--- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java
+++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/BreakpointLocationLocator.java
@@ -22,8 +22,8 @@ public class BreakpointLocationLocator
public BreakpointLocationLocator(CompilationUnit compilationUnit, int lineNumber,
boolean bindingsResolved,
- boolean bestMatch) {
- super(compilationUnit, lineNumber, bindingsResolved, bestMatch);
+ boolean bestMatch, int offset, int end) {
+ super(compilationUnit, lineNumber, bindingsResolved, bestMatch, offset, end);
}
@Override
diff --git a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java
index 6a706434..1ebf4c7c 100644
--- a/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java
+++ b/com.microsoft.java.debug.plugin/src/main/java/com/microsoft/java/debug/plugin/internal/JdtSourceLookUpProvider.java
@@ -72,8 +72,8 @@
import com.microsoft.java.debug.core.Configuration;
import com.microsoft.java.debug.core.DebugException;
import com.microsoft.java.debug.core.DebugSettings;
-import com.microsoft.java.debug.core.JavaBreakpointLocation;
import com.microsoft.java.debug.core.DebugSettings.Switch;
+import com.microsoft.java.debug.core.JavaBreakpointLocation;
import com.microsoft.java.debug.core.adapter.AdapterUtils;
import com.microsoft.java.debug.core.adapter.Constants;
import com.microsoft.java.debug.core.adapter.IDebugAdapterContext;
@@ -210,8 +210,11 @@ public JavaBreakpointLocation[] getBreakpointLocations(String sourceUri, SourceB
// mark it as "unverified".
// In future, we could consider supporting to update the breakpoint to a valid
// location.
+
+ // passing the offset to the constructor, it can recognize the multiline lambda
+ // expression well
BreakpointLocationLocator locator = new BreakpointLocationLocator(astUnit,
- sourceLine, true, true);
+ sourceLine, true, true, astUnit.getPosition(sourceLine, 0), 0);
astUnit.accept(locator);
// When the final valid line location is same as the original line, that
// represents it's a valid breakpoint.
@@ -248,7 +251,7 @@ private BreakpointLocation[] getInlineBreakpointLocations(final CompilationUnit
public boolean visit(LambdaExpression node) {
int lambdaStart = node.getStartPosition();
int startLine = astUnit.getLineNumber(lambdaStart);
- if (findNearestRelatedLineToLambda(node) == sourceLine) {
+ if (startLine == sourceLine) {
int startColumn = astUnit.getColumnNumber(lambdaStart);
int lambdaEnd = lambdaStart + node.getLength();
int endLine = astUnit.getLineNumber(lambdaEnd);
@@ -258,21 +261,6 @@ public boolean visit(LambdaExpression node) {
}
return super.visit(node);
}
-
- private int findNearestRelatedLineToLambda(LambdaExpression lambda) {
- ASTNode node = lambda;
- while (node != null) {
- int line = astUnit.getLineNumber(node.getStartPosition());
- if(line == sourceLine) {
- return line;
- } else if (line < sourceLine) {
- // the lambda doesn't belong to current line at all
- break;
- }
- node = node.getParent();
- }
- return -1;
- }
});
return locations.toArray(BreakpointLocation[]::new);
diff --git a/com.microsoft.java.debug.target/com.microsoft.java.debug.tp.target b/com.microsoft.java.debug.target/com.microsoft.java.debug.tp.target
index ef0a5284..a1d90d48 100644
--- a/com.microsoft.java.debug.target/com.microsoft.java.debug.tp.target
+++ b/com.microsoft.java.debug.target/com.microsoft.java.debug.tp.target
@@ -17,7 +17,7 @@
-
+