Skip to content

Commit d34796d

Browse files
authored
Merge branch 'eclipse-jdt:master' into master
2 parents b1f07da + a4583f0 commit d34796d

54 files changed

Lines changed: 1273 additions & 330 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

org.eclipse.jdt.debug.tests/console tests/org/eclipse/jdt/debug/tests/console/TestMessageConsoleActionDelegate.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2015 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,7 +20,6 @@
2020
import org.eclipse.jface.viewers.ISelection;
2121
import org.eclipse.swt.graphics.Color;
2222
import org.eclipse.swt.widgets.ColorDialog;
23-
import org.eclipse.swt.widgets.Display;
2423
import org.eclipse.swt.widgets.Event;
2524
import org.eclipse.ui.IActionDelegate2;
2625
import org.eclipse.ui.IWorkbenchWindow;
@@ -77,7 +76,7 @@ public void run(IAction action) {
7776
stream.println("two.... three....");
7877
ColorDialog dialog = new ColorDialog(DebugUIPlugin.getShell());
7978
dialog.open();
80-
Color color = new Color(Display.getCurrent(), dialog.getRGB());
79+
Color color = new Color(dialog.getRGB());
8180
stream.setColor(color);
8281
}
8382

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 IBM Corporation.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* IBM Corporation - initial API and implementation
13+
*******************************************************************************/
14+
public class InnerClassBug {
15+
16+
public static void main(String[] args) {
17+
InnerClassBug a = new InnerClassBug();
18+
T t = a.new T(4);
19+
System.out.println(t.x);
20+
}
21+
22+
private class T {
23+
final int x;
24+
private T(int x1) {
25+
this.x = x1;
26+
}
27+
}
28+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 IBM Corporation.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* IBM Corporation - initial API and implementation
13+
*******************************************************************************/
14+
public class SubClass extends SuperClass {
15+
private boolean fInitialized;
16+
17+
public SubClass() {
18+
fInitialized = false;
19+
System.out.println("SubClass constructor");
20+
}
21+
22+
public static void main(String[] args) {
23+
new SubClass();
24+
}
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 IBM Corporation.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* IBM Corporation - initial API and implementation
13+
*******************************************************************************/
14+
public class SuperClass {
15+
private boolean fInitialized = true;
16+
17+
public SuperClass() {
18+
19+
}
20+
}

org.eclipse.jdt.debug.tests/test plugin/org/eclipse/jdt/debug/testplugin/detailpane/SimpleDetailPane.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2007, 2015 IBM Corporation and others.
2+
* Copyright (c) 2007, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -76,24 +76,24 @@ public Control createControl(Composite parent) {
7676
private Color getColor(int typeId){
7777
if (typeId == TYPE_PRIVATE){
7878
if (colorPrivate == null || colorPrivate.isDisposed()){
79-
colorPrivate = new Color(theLabel.getDisplay(),255,0,0);
79+
colorPrivate = new Color(255, 0, 0);
8080
}
8181
return colorPrivate;
8282
}
8383
if (typeId == TYPE_PROTECTED){
8484
if (colorProtected == null || colorProtected.isDisposed()){
85-
colorProtected = new Color(theLabel.getDisplay(),0,0,255);
85+
colorProtected = new Color(0, 0, 255);
8686
}
8787
return colorProtected;
8888
}
8989
if (typeId == TYPE_PUBLIC){
9090
if (colorPublic == null || colorPublic.isDisposed()){
91-
colorPublic = new Color(theLabel.getDisplay(),0,255,0);
91+
colorPublic = new Color(0, 255, 0);
9292
}
9393
return colorPublic;
9494
}
9595
if (colorOther == null || colorOther.isDisposed()){
96-
colorOther = new Color(theLabel.getDisplay(),0,0,0);
96+
colorOther = new Color(0, 0, 0);
9797
}
9898
return colorOther;
9999
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 Simeon Andreev and others.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* Simeon Andreev - initial API and implementation
13+
*******************************************************************************/
14+
package selectiontests;
15+
16+
import java.util.Arrays;
17+
import java.util.List;
18+
19+
/**
20+
* The test resumes at lambda chain and at each resume expects selecting the next lambda expression.
21+
*/
22+
public class LambdaSelectionTest {
23+
24+
public static void main(String[] main) {
25+
List<String> list = Arrays.asList("A");
26+
list.stream()
27+
.map(s -> s.toLowerCase()).filter(s -> s.equals("b")).forEach(System.out::println); // line 27, test breakpoint is set here
28+
}
29+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2026 IBM Corporation.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* IBM Corporation - initial API and implementation
13+
*******************************************************************************/
14+
15+
/**
16+
* WatchItemContext
17+
*/
18+
public class WatchItemContext {
19+
20+
private class X {
21+
private int x = 0;
22+
}
23+
24+
private class Y {
25+
private X x = new X();
26+
private int y = 0;
27+
}
28+
29+
private class Z {
30+
private Y y = new Y();
31+
private int z = 0;
32+
}
33+
34+
public static void main(String[] args) {
35+
new WatchItemContext().foo();
36+
}
37+
38+
public void foo() {
39+
X x = new X();
40+
Y y = new Y();
41+
Z z = new Z();
42+
System.out.println(x + " " + y + " " + z);
43+
}
44+
}

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import java.io.File;
2020
import java.io.PrintWriter;
2121
import java.io.StringWriter;
22+
import java.net.BindException;
2223
import java.util.ArrayList;
2324
import java.util.Arrays;
2425
import java.util.Collection;
@@ -177,6 +178,7 @@
177178
@SuppressWarnings("deprecation")
178179
public abstract class AbstractDebugTest extends TestCase implements IEvaluationListener {
179180

181+
private static final int SOCKET_BIND_ERROR_MAX_RETRIES = 3;
180182
private static boolean setupFirstTest = false;
181183

182184
public static final String MULTI_OUTPUT_PROJECT_NAME = "MultiOutput";
@@ -219,7 +221,7 @@ public abstract class AbstractDebugTest extends TestCase implements IEvaluation
219221
"OutSync", "OutSync2", "ConsoleOutputUmlaut", "ErrorRecurrence", "ModelPresentationTests", "Bug565982",
220222
"SuspendVMConditionalBreakpointsTestSnippet", "FileConditionSnippet2", "compare.CompareObjectsStringTest", "compare.CompareListObjects",
221223
"compare.CompareMapObjects", "compare.CompareSetObjects", "compare.CompareNormalObjects", "compare.CompareArrayObjects",
222-
"StatementStep", "StatementStepArgument", "StatementStepNested", "StatementStepWithOperations" };
224+
"StatementStep", "StatementStepArgument", "StatementStepNested", "StatementStepWithOperations", "WatchItemContext" };
223225

224226
/**
225227
* the default timeout
@@ -551,6 +553,9 @@ synchronized void assert18Project() {
551553
cfgs.add(createLaunchConfiguration(jp, "LambdaBreakpoints1"));
552554
cfgs.add(createLaunchConfiguration(jp, "GH275"));
553555
cfgs.add(createLaunchConfiguration(jp, "LambdaTest"));
556+
cfgs.add(createLaunchConfiguration(jp, "InnerClassBug"));
557+
cfgs.add(createLaunchConfiguration(jp, "SuperClass"));
558+
cfgs.add(createLaunchConfiguration(jp, "SubClass"));
554559
loaded18 = true;
555560
waitForBuild();
556561
}
@@ -1487,13 +1492,7 @@ protected Object launchAndWait(ILaunchConfiguration configuration, DebugEventWai
14871492
* if the event is never received.
14881493
*/
14891494
protected Object launchAndWait(ILaunchConfiguration configuration, String mode, DebugEventWaiter waiter, boolean register) throws CoreException {
1490-
ILaunch launch;
1491-
try {
1492-
launch = configuration.launch(mode, new TimeoutMonitor(DEFAULT_TIMEOUT), false, register);
1493-
} catch (Throwable t) {
1494-
logProcessConsoleContents();
1495-
throw t;
1496-
}
1495+
ILaunch launch = launchConfig(configuration, mode, register);
14971496
Object suspendee= waiter.waitForEvent();
14981497
if (suspendee == null) {
14991498
StringBuilder buf = new StringBuilder();
@@ -1536,8 +1535,6 @@ protected Object launchAndWait(ILaunchConfiguration configuration, String mode,
15361535
return suspendee;
15371536
}
15381537

1539-
1540-
15411538
/**
15421539
* Launches the type with the given name, and waits for a
15431540
* suspend event in that program. Returns the thread in which the suspend
@@ -2225,6 +2222,20 @@ protected IJavaMethodBreakpoint createMethodBreakpoint(IJavaProject project, Str
22252222
protected IJavaMethodBreakpoint createMethodBreakpoint(String packageName, String cuName, String typeName, String methodName, String methodSignature, boolean entry, boolean exit) throws Exception {
22262223
IType type = getType(packageName, cuName, typeName);
22272224
assertNotNull("did not find type to install breakpoint in", type); //$NON-NLS-1$
2225+
return createMethodBreakpoint(type, methodName, methodSignature, entry, exit);
2226+
}
2227+
2228+
/**
2229+
* Creates a method breakpoint in a specified type.
2230+
*
2231+
* @param type the type in which the method breakpoint is set
2232+
* @param methodName method or <code>null</code> for all methods
2233+
* @param methodSignature JLS method signature or <code>null</code> for all methods with the given name
2234+
* @param entry whether to break on entry
2235+
* @param exit whether to break on exit
2236+
* @return method breakpoint
2237+
*/
2238+
protected IJavaMethodBreakpoint createMethodBreakpoint(IType type, String methodName, String methodSignature, boolean entry, boolean exit) throws Exception {
22282239
IMethod method= null;
22292240
if (methodSignature != null && methodName != null) {
22302241
if (type != null ) {
@@ -3207,6 +3218,28 @@ private static void logVMChange(String message, IVMInstall vm) {
32073218
JDIDebugPlugin.log(status);
32083219
}
32093220

3221+
private static ILaunch launchConfig(ILaunchConfiguration configuration, String mode, boolean register) throws CoreException {
3222+
ILaunch launch = null;
3223+
for (int retry = 1; retry <= SOCKET_BIND_ERROR_MAX_RETRIES; ++retry) {
3224+
try {
3225+
launch = configuration.launch(mode, new TimeoutMonitor(DEFAULT_TIMEOUT), false, register);
3226+
break;
3227+
} catch (CoreException e) {
3228+
Throwable cause = e.getStatus().getException();
3229+
if (retry < SOCKET_BIND_ERROR_MAX_RETRIES && cause instanceof BindException) {
3230+
// port might be in use between checking for a free port and launching, try a few times
3231+
DebugPlugin.log(Status.error("Could not bind socket for debugging, retry: " + retry, e));
3232+
} else {
3233+
throw e;
3234+
}
3235+
} catch (Throwable t) {
3236+
logProcessConsoleContents();
3237+
throw t;
3238+
}
3239+
}
3240+
return launch;
3241+
}
3242+
32103243
private static void logProcessConsoleContents() {
32113244
try {
32123245
StringBuilder buf = new StringBuilder();

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@
135135
import org.eclipse.jdt.debug.tests.refactoring.RenamePublicTypeUnitTests;
136136
import org.eclipse.jdt.debug.tests.sourcelookup.ArchiveSourceLookupTests;
137137
import org.eclipse.jdt.debug.tests.sourcelookup.Bug565462Tests;
138+
import org.eclipse.jdt.debug.tests.sourcelookup.ClassFileEditorHighlightingTest;
138139
import org.eclipse.jdt.debug.tests.sourcelookup.DefaultSourceContainerTests;
139140
import org.eclipse.jdt.debug.tests.sourcelookup.DirectorySourceContainerTests;
140141
import org.eclipse.jdt.debug.tests.sourcelookup.DirectorySourceLookupTests;
@@ -148,6 +149,7 @@
148149
import org.eclipse.jdt.debug.tests.sourcelookup.TypeResolutionTests;
149150
import org.eclipse.jdt.debug.tests.state.RefreshStateTests;
150151
import org.eclipse.jdt.debug.tests.ui.DebugHoverTests;
152+
import org.eclipse.jdt.debug.tests.ui.DebugSelectionTests;
151153
import org.eclipse.jdt.debug.tests.ui.DebugViewTests;
152154
import org.eclipse.jdt.debug.tests.ui.DetailPaneManagerTests;
153155
import org.eclipse.jdt.debug.tests.ui.HotCodeReplaceErrorDialogTest;
@@ -229,6 +231,8 @@ public AutomatedSuite() {
229231
addTest(new TestSuite(TypeResolutionTests.class));
230232
addTest(new TestSuite(JarSourceLookupTests.class));
231233
addTest(new TestSuite(Bug565462Tests.class));
234+
addTest(new TestSuite(DebugSelectionTests.class));
235+
addTest(new TestSuite(ClassFileEditorHighlightingTest.class));
232236

233237
// Variable tests
234238
addTest(new TestSuite(InstanceVariableTests.class));

org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/breakpoints/MethodBreakpointTests.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,9 @@ public void testDisabledEntryAndExitBreakpoints() throws Exception {
123123
try {
124124
debugTarget= launchAndTerminate(typeName);
125125
} finally {
126-
terminateAndRemove(debugTarget);
126+
if (debugTarget != null) {
127+
terminateAndRemove(debugTarget);
128+
}
127129
removeAllBreakpoints();
128130
}
129131
}

0 commit comments

Comments
 (0)