|
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,39 @@ public void testResolveIn2Lambdas() throws Exception { |
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 |
|
| 1530 | + public void testResolveSameFieldsInSuperAndSub() throws Exception { |
| 1531 | + sync(() -> TestUtil.waitForJobs(getName(), 1000, 10000, ProcessConsole.class)); |
| 1532 | + |
| 1533 | + final String typeName = "SubClass"; |
| 1534 | + final String expectedMethod = "<init>"; |
| 1535 | + final int framesNumber = 2; |
| 1536 | + final int bpLine1 = 18; |
| 1537 | + |
| 1538 | + IJavaBreakpoint bp1 = createLineBreakpoint(bpLine1, "", typeName + ".java", typeName); |
| 1539 | + bp1.setSuspendPolicy(IJavaBreakpoint.SUSPEND_THREAD); |
| 1540 | + IFile file = (IFile) bp1.getMarker().getResource(); |
| 1541 | + assertEquals(typeName + ".java", file.getName()); |
| 1542 | + |
| 1543 | + IJavaThread thread = null; |
| 1544 | + try { |
| 1545 | + thread = launchToBreakpoint(typeName); |
| 1546 | + CompilationUnitEditor part = openEditorAndValidateStack(expectedMethod, framesNumber, file, thread); |
| 1547 | + |
| 1548 | + JavaDebugHover hover = new JavaDebugHover(); |
| 1549 | + hover.setEditor(part); |
| 1550 | + int offset = part.getViewer().getDocument().get().indexOf("fInitialized = "); |
| 1551 | + String variableName = "fInitialized"; |
| 1552 | + IRegion region = new Region(offset, variableName.length()); |
| 1553 | + String text = selectAndReveal(part, bpLine1, region); |
| 1554 | + assertEquals(variableName, text); |
| 1555 | + IVariable info = (IVariable) sync(() -> hover.getHoverInfo2(part.getViewer(), region)); |
| 1556 | + assertNotNull(info); |
| 1557 | + assertEquals(variableName, info.getName()); |
| 1558 | + assertEquals("false", info.getValue().getValueString()); |
| 1559 | + } finally { |
| 1560 | + terminateAndRemove(thread); |
| 1561 | + removeAllBreakpoints(); |
| 1562 | + } |
| 1563 | + } |
| 1564 | + |
1530 | 1565 | } |
0 commit comments