|
1 | 1 | /******************************************************************************* |
2 | | - * Copyright (c) 2017, 2024 Andrey Loskutov and others. |
| 2 | + * Copyright (c) 2017, 2026 Andrey Loskutov and others. |
3 | 3 | * |
4 | 4 | * This program and the accompanying materials |
5 | 5 | * are made available under the terms of the Eclipse Public License 2.0 |
@@ -1527,4 +1527,36 @@ public void testResolveIn2Lambdas() throws Exception { |
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 |
|
| 1530 | + public void testHoverOnInnerClassConstructorVariables() throws Exception { |
| 1531 | + sync(() -> TestUtil.waitForJobs(getName(), 1000, 10000, ProcessConsole.class)); |
| 1532 | + final String typeName = "InnerClassBug"; |
| 1533 | + final String expectedMethod = "<init>"; |
| 1534 | + final int frameNumber = 3; |
| 1535 | + final int bpLine = 25; |
| 1536 | + IJavaBreakpoint bp = createLineBreakpoint(bpLine, "", typeName + ".java", typeName); |
| 1537 | + bp.setSuspendPolicy(IJavaBreakpoint.SUSPEND_THREAD); |
| 1538 | + IFile file = (IFile) bp.getMarker().getResource(); |
| 1539 | + assertEquals(typeName + ".java", file.getName()); |
| 1540 | + IJavaThread thread = null; |
| 1541 | + try { |
| 1542 | + thread = launchToBreakpoint(typeName); |
| 1543 | + CompilationUnitEditor part = openEditorAndValidateStack(expectedMethod, frameNumber, file, thread); |
| 1544 | + JavaDebugHover hover = new JavaDebugHover(); |
| 1545 | + hover.setEditor(part); |
| 1546 | + String variableName = "x1"; |
| 1547 | + int offset = part.getViewer().getDocument().get().indexOf("this.x = x1") + " this.x =".length(); |
| 1548 | + IRegion region = new Region(offset, variableName.length()); |
| 1549 | + String text = selectAndReveal(part, bpLine, region); |
| 1550 | + assertEquals(variableName, text); |
| 1551 | + IVariable info = (IVariable) sync(() -> hover.getHoverInfo2(part.getViewer(), region)); |
| 1552 | + |
| 1553 | + assertNotNull(info); |
| 1554 | + assertEquals(variableName, info.getName()); |
| 1555 | + assertEquals("4", info.getValue().getValueString()); |
| 1556 | + } finally { |
| 1557 | + terminateAndRemove(thread); |
| 1558 | + removeAllBreakpoints(); |
| 1559 | + } |
| 1560 | + } |
| 1561 | + |
1530 | 1562 | } |
0 commit comments