Bug 577682 - [18] Release Activities
Merge remote-tracking branch 'origin/BETA_JAVA18'
Conflicts:
org.eclipse.jdt.launching/META-INF/MANIFEST.MF
org.eclipse.jdt.launching/pom.xml
Change-Id: Ib156ab75c4ee01c90fa9a91d8e19a93390fb362e
diff --git a/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF
index 8319272..8915312 100644
--- a/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug.tests/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug.tests; singleton:=true
-Bundle-Version: 3.11.1600.qualifier
+Bundle-Version: 3.11.1700.qualifier
Bundle-ClassPath: javadebugtests.jar
Bundle-Activator: org.eclipse.jdt.debug.testplugin.JavaTestPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.jdt.debug.tests/pom.xml b/org.eclipse.jdt.debug.tests/pom.xml
index 4eea521..18131b2 100644
--- a/org.eclipse.jdt.debug.tests/pom.xml
+++ b/org.eclipse.jdt.debug.tests/pom.xml
@@ -15,11 +15,11 @@
<parent>
<artifactId>eclipse.jdt.debug</artifactId>
<groupId>eclipse.jdt.debug</groupId>
- <version>4.23.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug.tests</artifactId>
- <version>3.11.1600-SNAPSHOT</version>
+ <version>3.11.1700-SNAPSHOT</version>
<packaging>eclipse-test-plugin</packaging>
<properties>
<code.ignoredWarnings>${tests.ignoredWarnings}</code.ignoredWarnings>
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DebugHoverTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DebugHoverTests.java
index 50f7248..36818e3 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DebugHoverTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/DebugHoverTests.java
@@ -13,6 +13,8 @@
*******************************************************************************/
package org.eclipse.jdt.debug.tests.ui;
+import static org.junit.Assert.assertNotEquals;
+
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -1240,7 +1242,7 @@
thread = launchToBreakpoint(typeName);
CompilationUnitEditor part = openEditorAndValidateStack(expectedMethod, frameNumber, file, thread);
- selectFrame(thread.getStackFrames()[4]);
+ selectFrame(part, thread.getStackFrames()[4]);
JavaDebugHover hover = new JavaDebugHover();
hover.setEditor(part);
@@ -1453,7 +1455,7 @@
return sync(() -> selection.getText());
}
- private void selectFrame(IStackFrame frame) throws Exception {
+ private void selectFrame(CompilationUnitEditor editor, IStackFrame frame) throws Exception {
LaunchView debugView = sync(() -> (LaunchView) getActivePage().findView(IDebugUIConstants.ID_DEBUG_VIEW));
assertNotNull("expected Debug View to be open", debugView);
@@ -1461,8 +1463,25 @@
TreePath path = selection.getPaths()[0];
TreePath newPath = path.getParentPath().createChildPath(frame);
TreeSelection newSelection = new TreeSelection(newPath);
- sync(() -> debugView.getViewer().setSelection(newSelection, true));
- processUiEvents(100);
+
+ // frames uses 1 based line number, subtract 1 to line up with editor line numbers
+ int targetLineNumber = frame.getLineNumber() - 1;
+ int initialLineNumber = sync(() -> ((ITextSelection) editor.getSelectionProvider().getSelection()).getStartLine());
+ assertNotEquals("selectFrame cannot detect when it has"
+ + "completed because selecting frame doesn't change the line number.", initialLineNumber, targetLineNumber);
+ final int timeoutms = 1000;
+ int selectedLineNumer = sync(() -> {
+ int lineNumber;
+ long endtime = System.currentTimeMillis() + timeoutms;
+ debugView.getViewer().setSelection(newSelection, true);
+ do {
+ TestUtil.runEventLoop();
+ lineNumber = ((ITextSelection) editor.getSelectionProvider().getSelection()).getStartLine();
+ } while (lineNumber != targetLineNumber && System.currentTimeMillis() < endtime);
+ return lineNumber;
+ });
+ assertEquals("After waiting " + timeoutms
+ + "ms the editor selection was not moved to the expected line", targetLineNumber, selectedLineNumer);
}
@Override
diff --git a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/OpenFromClipboardTests.java b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/OpenFromClipboardTests.java
index a2a3361..9e3300e 100644
--- a/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/OpenFromClipboardTests.java
+++ b/org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/ui/OpenFromClipboardTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2018 IBM Corporation and others.
+ * Copyright (c) 2010, 2022 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,6 +20,7 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
@@ -28,6 +29,8 @@
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.debug.testplugin.JavaProjectHelper;
import org.eclipse.jdt.debug.tests.TestAgainException;
+import org.eclipse.jdt.debug.tests.TestUtil;
+import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jdt.internal.debug.ui.actions.OpenFromClipboardAction;
import org.eclipse.jdt.launching.IVMInstall;
import org.eclipse.jdt.launching.JavaRuntime;
@@ -120,12 +123,14 @@
@Override
protected void setUp() throws Exception {
+ TestUtil.log(IStatus.INFO, getName(), "setUp");
super.setUp();
fSourceFolder = JavaProjectHelper.addSourceContainer(MyTestSetup.fJProject, "src");
}
@Override
protected void tearDown() throws Exception {
+ TestUtil.log(IStatus.INFO, getName(), "tearDown");
JavaProjectHelper.removeSourceContainer(MyTestSetup.fJProject, "src");
super.tearDown();
}
@@ -136,6 +141,7 @@
}
private List<?> getJavaElementMatches(final String textData) {
+ JavaModelManager.getIndexManager().waitForIndex(false, null);
final List<?> matches = new ArrayList<>();
Display.getDefault().syncExec(new Runnable() {
@Override
@@ -166,9 +172,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testClassFileLine_1 test again");
- }
assertEquals(1, matches.size());
}
@@ -178,9 +181,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testClassFileLine_2 test again");
- }
assertEquals(1, matches.size());
}
@@ -190,9 +190,6 @@
setupTypeTest("OpenFromClipboard$Tests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testClassFileLine_3 test again");
- }
assertEquals(1, matches.size());
}
@@ -205,9 +202,6 @@
setupTypeTest(typeName);
List<?> matches= getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testDBCS test again");
- }
assertEquals(1, matches.size());
}
@@ -220,9 +214,6 @@
setupTypeTest(typeName);
List<?> matches= getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testUmlaut test again");
- }
assertEquals(1, matches.size());
}
@@ -232,9 +223,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testClassFile_1 test again");
- }
assertEquals(1, matches.size());
}
@@ -244,9 +232,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testTypeLine_1 test again");
- }
assertEquals(1, matches.size());
}
@@ -256,9 +241,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testTypeLine_2 test again");
- }
assertEquals(1, matches.size());
}
@@ -269,9 +251,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackTraceLine_1 test again");
- }
assertEquals(1, matches.size());
}
@@ -281,9 +260,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackTraceLine_2 test again");
- }
assertEquals(1, matches.size());
}
@@ -293,9 +269,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackTraceLine_3 test again");
- }
assertEquals(1, matches.size());
}
@@ -305,9 +278,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackTraceLine_4 test again");
- }
assertEquals(1, matches.size());
}
@@ -317,9 +287,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackTraceLine_5 test again");
- }
assertEquals(1, matches.size());
}
@@ -329,9 +296,6 @@
setupTypeTest("OpenFromClipboard$Tests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackTraceLine_6 test again");
- }
assertEquals(1, matches.size());
}
@@ -342,9 +306,6 @@
setupTypeTest("OpenFromClipboardTests");
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackTraceLine_7 test again");
- }
assertEquals(1, matches.size());
}
@@ -370,9 +331,6 @@
setupMethodTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_1 test again");
- }
assertEquals(1, matches.size());
}
@@ -382,9 +340,6 @@
setupMethodTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_2 test again");
- }
assertEquals(1, matches.size());
}
@@ -394,9 +349,6 @@
setupMethodTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_3 test again");
- }
assertEquals(1, matches.size());
}
@@ -406,9 +358,6 @@
setupMethodTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_4 test again");
- }
assertEquals(1, matches.size());
}
@@ -418,9 +367,6 @@
setupMethodTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_5 test again");
- }
assertEquals(1, matches.size());
}
@@ -430,9 +376,6 @@
setupMethodTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_6 test again");
- }
assertEquals(1, matches.size());
}
@@ -442,9 +385,6 @@
setupMethodTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_7 test again");
- }
assertEquals(1, matches.size());
}
@@ -489,9 +429,6 @@
setupMethodWithDollarSignTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_10 test again");
- }
assertEquals(1, matches.size());
}
@@ -501,9 +438,6 @@
setupMethodWithDollarSignTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMethod_11 test again");
- }
assertEquals(1, matches.size());
}
@@ -525,9 +459,6 @@
setupMemberTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMember_1 test again");
- }
assertEquals(1, matches.size());
}
@@ -537,9 +468,6 @@
setupMemberTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMember_2 test again");
- }
assertEquals(1, matches.size());
}
@@ -549,9 +477,6 @@
setupMemberTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testMember_3 test again");
- }
assertEquals(1, matches.size());
}
@@ -574,9 +499,6 @@
setupMemberTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testQualifiedName_2 test again");
- }
assertEquals(1, matches.size());
}
@@ -586,9 +508,6 @@
setupMemberTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testQualifiedName_3 test again");
- }
assertEquals(1, matches.size());
}
@@ -617,9 +536,6 @@
setupQualifiedNameWithDollarSignTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testQualifiedName_4 test again");
- }
assertEquals(1, matches.size());
}
@@ -629,9 +545,6 @@
setupQualifiedNameWithDollarSignTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testQualifiedName_5 test again");
- }
assertEquals(1, matches.size());
}
@@ -641,9 +554,6 @@
setupQualifiedNameWithDollarSignTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testQualifiedName_6 test again");
- }
assertEquals(1, matches.size());
}
@@ -665,9 +575,6 @@
setupStackElementTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackElement_1 test again");
- }
assertEquals(1, matches.size());
}
@@ -677,9 +584,6 @@
setupStackElementTest();
List<?> matches = getJavaElementMatches(s);
- if (matches.size() != 1) {
- throw new TestAgainException("testStackElement_2 test again");
- }
assertEquals(1, matches.size());
}
diff --git a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
index ca7b15f..f394a68 100644
--- a/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug.ui; singleton:=true
-Bundle-Version: 3.12.600.qualifier
+Bundle-Version: 3.12.700.qualifier
Bundle-Activator: org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.debug.ui/plugin.xml b/org.eclipse.jdt.debug.ui/plugin.xml
index 6b6594a..dcd097f 100644
--- a/org.eclipse.jdt.debug.ui/plugin.xml
+++ b/org.eclipse.jdt.debug.ui/plugin.xml
@@ -935,6 +935,16 @@
</objectState>
</not>
</visibility>
+ </objectContribution>
+ <objectContribution
+ objectClass="org.eclipse.jdt.debug.core.IJavaVariable"
+ id="org.eclipse.jdt.debug.ui.JavaVariableActions">
+ <visibility>
+ <objectState
+ name="JavaVariableFilter"
+ value="isNonNullObjectValue">
+ </objectState>
+ </visibility>
<action
class="org.eclipse.jdt.internal.debug.ui.actions.SetObjectLabelAction"
enablesFor="1"
diff --git a/org.eclipse.jdt.debug.ui/pom.xml b/org.eclipse.jdt.debug.ui/pom.xml
index 2a90e95..c68a14a 100644
--- a/org.eclipse.jdt.debug.ui/pom.xml
+++ b/org.eclipse.jdt.debug.ui/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.jdt.debug</artifactId>
<groupId>eclipse.jdt.debug</groupId>
- <version>4.23.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug.ui</artifactId>
- <version>3.12.600-SNAPSHOT</version>
+ <version>3.12.700-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<properties>
<code.ignoredWarnings>-warn:+resource,-deprecation,unavoidableGenericProblems</code.ignoredWarnings>
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaVarActionFilter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaVarActionFilter.java
index fbf7705..35f1fda 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaVarActionFilter.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JavaVarActionFilter.java
@@ -196,6 +196,10 @@
if (value.equals("isObjectValue")) { //$NON-NLS-1$
return varValue != null && JDIObjectValue.class.isAssignableFrom(varValue.getClass());
}
+ if (value.equals("isNonNullObjectValue")) { //$NON-NLS-1$
+ return varValue != null && JDIObjectValue.class.isAssignableFrom(varValue.getClass())
+ && !((JDIObjectValue) varValue).isNull();
+ }
if (value.equals("isFieldVariable")) { //$NON-NLS-1$
return var instanceof IJavaFieldVariable;
}
@@ -259,4 +263,4 @@
protected boolean isInstanceRetrievalAvailable(IJavaVariable var) {
return ((IJavaDebugTarget)var.getDebugTarget()).supportsInstanceRetrieval() && !(var instanceof JDIReferenceListVariable);
}
-}
\ No newline at end of file
+}
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/SetObjectLabelAction.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/SetObjectLabelAction.java
index 1936251..80d8cee 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/SetObjectLabelAction.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/SetObjectLabelAction.java
@@ -58,7 +58,9 @@
}
if (value instanceof IJavaObject) {
final IJavaObject javaValue = (IJavaObject) value;
- askForLabel(javaValue, name);
+ if (!javaValue.isNull()) {
+ askForLabel(javaValue, name);
+ }
}
} catch (DebugException e) {
return;
diff --git a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
index 4e34313..8098a9f 100644
--- a/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
+++ b/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/actions/ToggleBreakpointAdapter.java
@@ -269,7 +269,7 @@
job.schedule();
}
- public void toggleLambdaEntryMethodBreakpoints(final IWorkbenchPart part, final ISelection finalSelection, final String lambdaMethodName) {
+ public void toggleLambdaEntryMethodBreakpoints(final IWorkbenchPart part, final ISelection finalSelection, final String lambdaMethodName, final String lambdaMethodSignature) {
Job job = new Job("Toggle Lambda Entry Method Breakpoints") { //$NON-NLS-1$
@Override
protected IStatus run(IProgressMonitor monitor) {
@@ -277,7 +277,7 @@
return Status.CANCEL_STATUS;
}
try {
- return doToggleLambdaEntryMethodBreakpoints(part, finalSelection, lambdaMethodName, monitor);
+ return doToggleLambdaEntryMethodBreakpoints(part, finalSelection, lambdaMethodName, lambdaMethodSignature, monitor);
} catch (CoreException e) {
return e.getStatus();
} finally {
@@ -290,7 +290,7 @@
job.schedule();
}
- static IStatus doToggleLambdaEntryMethodBreakpoints(IWorkbenchPart part, ISelection selection, String lambdaMethodName, IProgressMonitor monitor) throws CoreException {
+ static IStatus doToggleLambdaEntryMethodBreakpoints(IWorkbenchPart part, ISelection selection, String lambdaMethodName, String lambdaMethodSignature, IProgressMonitor monitor) throws CoreException {
ITextEditor textEditor = getTextEditor(part);
if (textEditor == null || !(selection instanceof ITextSelection)) {
return Status.OK_STATUS;
@@ -316,7 +316,7 @@
}
if (method != null) {
- doToggleMethodBreakpoint(method, lambdaMethodName, part, selection, monitor);
+ doToggleMethodBreakpoint(method, lambdaMethodName, lambdaMethodSignature, part, selection, monitor);
} else {
BreakpointToggleUtils.report(ActionMessages.LambdaEntryBreakpointToggleAction_Unavailable, part);
}
@@ -354,7 +354,7 @@
}
if (method != null) {
- doToggleMethodBreakpoint(method, loc.getLambdaMethodName(), part, selection, monitor);
+ doToggleMethodBreakpoint(method, loc.getLambdaMethodName(), loc.getfLambdaMethodSignature(), part, selection, monitor);
} else {
ValidBreakpointLocationLocator locNew = new ValidBreakpointLocationLocator(loc.getCompilationUnit(), textSelection.getStartLine()
+ 1, true, true);
@@ -392,10 +392,10 @@
}
private static void doToggleMethodBreakpoint(IMethod member, IWorkbenchPart part, ISelection finalSelection, IProgressMonitor monitor) throws CoreException {
- doToggleMethodBreakpoint(member, null, part, finalSelection, monitor);
+ doToggleMethodBreakpoint(member, null, null, part, finalSelection, monitor);
}
- private static void doToggleMethodBreakpoint(IMethod member, String lambdaMethodName, IWorkbenchPart part, ISelection finalSelection, IProgressMonitor monitor) throws CoreException {
+ private static void doToggleMethodBreakpoint(IMethod member, String lambdaMethodName, String lambdaMethodSignature, IWorkbenchPart part, ISelection finalSelection, IProgressMonitor monitor) throws CoreException {
IJavaBreakpoint breakpoint = getMethodBreakpoint(member);
if (breakpoint != null) {
if (BreakpointToggleUtils.isToggleTracepoints()) {
@@ -416,15 +416,15 @@
Map<String, Object> attributes = new HashMap<>(10);
BreakpointUtils.addJavaBreakpointAttributes(attributes, member);
IType type = member.getDeclaringType();
- String signature = member.getSignature();
String mname = Optional.ofNullable(lambdaMethodName).orElse(member.getElementName());
+ String signature = Optional.ofNullable(lambdaMethodSignature).orElse(member.getSignature());
if (member.isConstructor()) {
mname = "<init>"; //$NON-NLS-1$
if (type.isEnum()) {
signature = "(Ljava.lang.String;I" + signature.substring(1); //$NON-NLS-1$
}
}
- if (!type.isBinary()) {
+ if (!type.isBinary() && lambdaMethodName == null) {
signature = resolveMethodSignature(member);
if (signature == null) {
BreakpointToggleUtils.report(ActionMessages.ManageMethodBreakpointActionDelegate_methodNonAvailable, part);
@@ -1283,6 +1283,7 @@
* @param element the element to get the breakpoint from
* @return the current breakpoint from the element or <code>null</code>
*/
+ @SuppressWarnings("restriction")
protected static IJavaBreakpoint getMethodBreakpoint(IMember element) {
IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();
IBreakpoint[] breakpoints = breakpointManager.getBreakpoints(JDIDebugModel.getPluginIdentifier());
@@ -1314,6 +1315,9 @@
}
} else {
if (container instanceof IMethod) {
+ if (method instanceof org.eclipse.jdt.internal.core.LambdaMethod) {
+ return null;
+ }
if (method.getDeclaringType().getFullyQualifiedName().equals(container.getDeclaringType().getFullyQualifiedName())) {
if (method.isSimilar((IMethod) container)) {
return methodBreakpoint;
@@ -1564,7 +1568,7 @@
lambdaEntryBP = true;
BreakpointToggleUtils.setUnsetLambdaEntryBreakpoint(false);
} else {
- loc = new ValidBreakpointLocationLocator(unit, ts.getStartLine() + 1, true, true);
+ loc = new ValidBreakpointLocationLocator(unit, ts.getStartLine() + 1, true, true, ts.getOffset(), ts.getLength());
}
unit.accept(loc);
@@ -1597,7 +1601,7 @@
return;
}
ITextSelection textSelection = new TextSelection(document, firstLambda.getNodeOffset(), firstLambda.getNodeLength());
- toggleLambdaEntryMethodBreakpoints(part, textSelection, firstLambda.getLambdaMethodName());
+ toggleLambdaEntryMethodBreakpoints(part, textSelection, firstLambda.getLambdaMethodName(), firstLambda.getfLambdaMethodSignature());
} catch (BadLocationException e) {
BreakpointToggleUtils.report(ActionMessages.LambdaEntryBreakpointToggleAction_Unavailable, part);
}
diff --git a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
index c0d4efe..e8eabbf 100644
--- a/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.debug/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.debug; singleton:=true
-Bundle-Version: 3.19.100.qualifier
+Bundle-Version: 3.19.200.qualifier
Bundle-ClassPath: jdimodel.jar
Bundle-Activator: org.eclipse.jdt.internal.debug.core.JDIDebugPlugin
Bundle-Vendor: %providerName
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/FirstLambdaLocationLocator.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/FirstLambdaLocationLocator.java
index 9f743a2..0013374 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/FirstLambdaLocationLocator.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/FirstLambdaLocationLocator.java
@@ -23,6 +23,7 @@
private int fLineOffset = -1;
private int fLineEndPosition = -1;
private String fLambdaMethodName;
+ private String fLambdaMethodSignature;
private boolean fLocationFound = false;
public FirstLambdaLocationLocator(int lineOffset, int lineEndPosition) {
@@ -37,6 +38,15 @@
return fLambdaMethodName;
}
+ /**
+ * Return of the signature of the lambda method where the valid location is.
+ * The signature is computed to be compatible with the final lambda method with
+ * method arguments and outer local variables.
+ */
+ public String getfLambdaMethodSignature() {
+ return fLambdaMethodSignature;
+ }
+
public int getNodeLength() {
return fNodeLength;
}
@@ -57,15 +67,10 @@
fNodeOffset = node.getStartPosition();
IMethodBinding methodBinding = node.resolveMethodBinding();
if (methodBinding != null) {
- fLambdaMethodName = toMethodName(methodBinding);
+ fLambdaMethodName = LambdaLocationLocatorHelper.toMethodName(methodBinding);
+ fLambdaMethodSignature = LambdaLocationLocatorHelper.toMethodSignature(methodBinding);
fLocationFound = true;
}
return false;
}
-
- private String toMethodName(IMethodBinding methodBinding) {
- String key = methodBinding.getKey();
- return key.substring(key.indexOf('.') + 1, key.indexOf('('));
- }
-
}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/LambdaLocationLocatorHelper.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/LambdaLocationLocatorHelper.java
new file mode 100644
index 0000000..4d8b542
--- /dev/null
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/LambdaLocationLocatorHelper.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2022 Gayan Perera and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Gayan Perera - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.jdt.internal.debug.core.breakpoints;
+
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.IMethodBinding;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+
+public final class LambdaLocationLocatorHelper {
+
+ private LambdaLocationLocatorHelper() {
+ }
+
+ /**
+ * Return of the signature of the lambda method. The signature is computed to
+ * be compatible with the final lambda method with method arguments and outer
+ * local variables in debugger.
+ */
+ public static String toMethodSignature(IMethodBinding methodBinding) {
+ StringBuilder builder = new StringBuilder();
+ builder.append('(');
+ if (methodBinding.getParameterTypes().length > 0 || methodBinding.getSyntheticOuterLocals().length > 0) {
+ builder.append(Stream.of(methodBinding.getSyntheticOuterLocals())
+ .map(b -> Signature.createTypeSignature(qualifiedName(b.getType()), true))
+ .collect(Collectors.joining()));
+
+ builder.append(Stream.of(methodBinding.getParameterTypes())
+ .map(b -> Signature.createTypeSignature(qualifiedName(b), true))
+ .collect(Collectors.joining()));
+ }
+ builder.append(')');
+ builder.append(Signature.createTypeSignature(qualifiedName(methodBinding.getReturnType()), true));
+ return builder.toString();
+ }
+
+ /**
+ * Return the lambda method name from the given method binding.
+ */
+ public static String toMethodName(IMethodBinding methodBinding) {
+ String key = methodBinding.getKey();
+ return key.substring(key.indexOf('.') + 1, key.indexOf('('));
+ }
+
+ private static String qualifiedName(ITypeBinding binding) {
+ return binding.getQualifiedName().replace('.', '/');
+ }
+}
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
index 7691d94..e758b1e 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/breakpoints/ValidBreakpointLocationLocator.java
@@ -140,6 +140,7 @@
private boolean fLocationFound;
private boolean fLambdaVisited;
private String fLambdaMethodName;
+ private String fLambdaMethodSignature;
private String fTypeName;
private int fLineLocation;
private int fMemberOffset;
@@ -227,6 +228,16 @@
public String getLambdaMethodName() {
return fLambdaMethodName;
}
+
+ /**
+ * Return of the signature of the lambda method where the valid location is.
+ * The signature is computed to be compatible with the final lambda method with
+ * method arguments and outer local variables.
+ */
+ public String getfLambdaMethodSignature() {
+ return fLambdaMethodSignature;
+ }
+
/**
* Return the line number of the computed valid location
*/
@@ -1024,7 +1035,8 @@
if (methodBinding != null) {
fLambdaVisited = true;
fLocationType = LOCATION_LAMBDA_METHOD;
- fLambdaMethodName = toMethodName(methodBinding);
+ fLambdaMethodName = LambdaLocationLocatorHelper.toMethodName(methodBinding);
+ fLambdaMethodSignature = LambdaLocationLocatorHelper.toMethodSignature(methodBinding);
fLocationFound = true;
return false;
}
@@ -1062,11 +1074,6 @@
return visit(node, true);
}
- private String toMethodName(IMethodBinding methodBinding) {
- String key = methodBinding.getKey();
- return key.substring(key.indexOf('.') + 1, key.indexOf('('));
- }
-
/*
* (non-Javadoc)
*
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java
index 96ab09a..0b0fcf2 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.java
@@ -133,6 +133,7 @@
public static String JDIStackFrame_ThrowingException;
public static String JDIStackFrame_NoMethodReturnValue;
public static String JDIStackFrame_NotObservedBecauseOfTimeout;
+ public static String JDIStackFrame_NoLongerAvailable;
public static String JDIThisVariable_exception_while_retrieving_type_this;
public static String JDIThisVariableexception_retrieving_reference_type_name;
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties
index 6c32a5f..75fce95 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugModelMessages.properties
@@ -100,6 +100,7 @@
JDIStackFrame_ThrowingException={0}() is throwing
JDIStackFrame_NoMethodReturnValue=no method return value
JDIStackFrame_NotObservedBecauseOfTimeout=(Not observed to speed up the long running step operation)
+JDIStackFrame_NoLongerAvailable=Stack frame is no longer available
JDIThisVariable_exception_while_retrieving_type_this={0} occurred while retrieving type ''this''.
JDIThisVariableexception_retrieving_reference_type_name={0} occurred retrieving reference type name.
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDILocalVariable.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDILocalVariable.java
index 8cc533b..532364c 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDILocalVariable.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDILocalVariable.java
@@ -24,6 +24,7 @@
import com.sun.jdi.InvalidTypeException;
import com.sun.jdi.LocalVariable;
import com.sun.jdi.ReferenceType;
+import com.sun.jdi.StackFrame;
import com.sun.jdi.Type;
import com.sun.jdi.Value;
@@ -58,8 +59,10 @@
protected Value retrieveValue() throws DebugException {
synchronized (fStackFrame.getThread()) {
if (getStackFrame().isSuspended()) {
- return getStackFrame().getUnderlyingStackFrame().getValue(
- fLocal);
+ StackFrame frame = getStackFrame().getUnderlyingStackFrame();
+ if (frame != null) {
+ return frame.getValue(fLocal);
+ }
}
}
// bug 6518
@@ -91,8 +94,16 @@
protected void setJDIValue(Value value) throws DebugException {
try {
synchronized (getStackFrame().getThread()) {
- getStackFrame().getUnderlyingStackFrame().setValue(getLocal(),
- value);
+ StackFrame frame = getStackFrame().getUnderlyingStackFrame();
+ if (frame != null) {
+ frame.setValue(getLocal(), value);
+ } else {
+ String errorMessage = JDIDebugModelMessages.JDIStackFrame_NoLongerAvailable;
+ targetRequestFailed(
+ MessageFormat.format(
+ JDIDebugModelMessages.JDILocalVariable_exception_modifying_local_variable_value,
+ errorMessage), new Throwable(errorMessage)); // use Throwable, as RuntimeException is re-thrown
+ }
}
fireChangeEvent(DebugEvent.CONTENT);
} catch (ClassNotLoadedException e) {
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
index fba88a9..d16573f 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIStackFrame.java
@@ -760,13 +760,16 @@
}
}
- List<LocalVariable> locals = null;
+ List<LocalVariable> locals = Collections.EMPTY_LIST;
try {
- locals = getUnderlyingStackFrame().visibleVariables();
+ StackFrame frame = getUnderlyingStackFrame();
+ if (frame != null) {
+ locals = frame.visibleVariables();
+ }
} catch (AbsentInformationException e) {
- locals = Collections.EMPTY_LIST;
+ // continue with empty list of variables
} catch (NativeMethodException e) {
- locals = Collections.EMPTY_LIST;
+ // continue with empty list of variables
} catch (RuntimeException e) {
targetRequestFailed(
MessageFormat.format(
@@ -980,7 +983,12 @@
synchronized (fThread) {
List<LocalVariable> variables = Collections.EMPTY_LIST;
try {
- variables = getUnderlyingStackFrame().visibleVariables();
+ StackFrame frame = getUnderlyingStackFrame();
+ if (frame != null) {
+ variables = frame.visibleVariables();
+ } else {
+ setLocalsAvailable(false);
+ }
} catch (AbsentInformationException e) {
setLocalsAvailable(false);
} catch (NativeMethodException e) {
@@ -1354,7 +1362,7 @@
throw new DebugException(new Status(IStatus.ERROR,
JDIDebugPlugin.getUniqueIdentifier(),
IJavaStackFrame.ERR_INVALID_STACK_FRAME,
- JDIDebugModelMessages.JDIStackFrame_25, null));
+ JDIDebugModelMessages.JDIStackFrame_25, new IllegalStateException()));
}
if (fThread.isSuspended()) {
// re-index stack frames - See Bug 47198
@@ -1364,14 +1372,14 @@
fThread.computeStackFrames();
if (fDepth == -1) {
// If depth is -1, then this is an invalid frame
- throw new DebugException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IJavaStackFrame.ERR_INVALID_STACK_FRAME, JDIDebugModelMessages.JDIStackFrame_25, null));
+ throw new DebugException(new Status(IStatus.ERROR, JDIDebugPlugin.getUniqueIdentifier(), IJavaStackFrame.ERR_INVALID_STACK_FRAME, JDIDebugModelMessages.JDIStackFrame_25, new IllegalStateException()));
}
}
} else {
throw new DebugException(new Status(IStatus.ERROR,
JDIDebugPlugin.getUniqueIdentifier(),
IJavaThread.ERR_THREAD_NOT_SUSPENDED,
- JDIDebugModelMessages.JDIStackFrame_25, null));
+ JDIDebugModelMessages.JDIStackFrame_25, new IllegalStateException()));
}
}
return fStackFrame;
diff --git a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
index ce6c70d..da164ea 100644
--- a/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
+++ b/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java
@@ -2361,7 +2361,11 @@
return;
}
setOriginalStepKind(getStepKind());
- Location location = top.getUnderlyingStackFrame().location();
+ StackFrame frame = top.getUnderlyingStackFrame();
+ if (frame == null) {
+ return;
+ }
+ Location location = frame.location();
setOriginalStepLocation(location);
setOriginalStepStackDepth(computeStackFrames().size());
setStepRequest(createStepRequest());
diff --git a/org.eclipse.jdt.debug/pom.xml b/org.eclipse.jdt.debug/pom.xml
index 7c9290d..a36c4f7 100644
--- a/org.eclipse.jdt.debug/pom.xml
+++ b/org.eclipse.jdt.debug/pom.xml
@@ -14,10 +14,10 @@
<parent>
<artifactId>eclipse.jdt.debug</artifactId>
<groupId>eclipse.jdt.debug</groupId>
- <version>4.23.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.debug</artifactId>
- <version>3.19.100-SNAPSHOT</version>
+ <version>3.19.200-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project>
diff --git a/org.eclipse.jdt.launching.macosx/pom.xml b/org.eclipse.jdt.launching.macosx/pom.xml
index 7c32e0b..f19d5cd 100644
--- a/org.eclipse.jdt.launching.macosx/pom.xml
+++ b/org.eclipse.jdt.launching.macosx/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.debug</artifactId>
<groupId>eclipse.jdt.debug</groupId>
- <version>4.23.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.launching.macosx</artifactId>
diff --git a/org.eclipse.jdt.launching.ui.macosx/pom.xml b/org.eclipse.jdt.launching.ui.macosx/pom.xml
index 317d463..4c1f459 100644
--- a/org.eclipse.jdt.launching.ui.macosx/pom.xml
+++ b/org.eclipse.jdt.launching.ui.macosx/pom.xml
@@ -14,7 +14,7 @@
<parent>
<artifactId>eclipse.jdt.debug</artifactId>
<groupId>eclipse.jdt.debug</groupId>
- <version>4.23.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.launching.ui.macosx</artifactId>
diff --git a/org.eclipse.jdt.launching/META-INF/MANIFEST.MF b/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
index 96d3c7c..a338954 100644
--- a/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
+++ b/org.eclipse.jdt.launching/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.jdt.launching; singleton:=true
-Bundle-Version: 3.19.550.qualifier
+Bundle-Version: 3.19.600.qualifier
Bundle-Activator: org.eclipse.jdt.internal.launching.LaunchingPlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.jdt.launching/pom.xml b/org.eclipse.jdt.launching/pom.xml
index ebe799d..9bdc4d0 100644
--- a/org.eclipse.jdt.launching/pom.xml
+++ b/org.eclipse.jdt.launching/pom.xml
@@ -14,11 +14,11 @@
<parent>
<artifactId>eclipse.jdt.debug</artifactId>
<groupId>eclipse.jdt.debug</groupId>
- <version>4.23.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
</parent>
<groupId>org.eclipse.jdt</groupId>
<artifactId>org.eclipse.jdt.launching</artifactId>
- <version>3.19.550-SNAPSHOT</version>
+ <version>3.19.600-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<build>
diff --git a/pom.xml b/pom.xml
index 2013a22..c4984ad 100644
--- a/pom.xml
+++ b/pom.xml
@@ -15,7 +15,7 @@
<parent>
<groupId>org.eclipse</groupId>
<artifactId>eclipse-platform-parent</artifactId>
- <version>4.23.0-SNAPSHOT</version>
+ <version>4.24.0-SNAPSHOT</version>
<relativePath>../eclipse-platform-parent</relativePath>
</parent>