Repository navigation
Fix wrong line on step into constructor reading a field before super() - #1052
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The workaround also matches ordinary constructors, so its extra STEP_INTO can execute the real super() call and suspend in the superclass rather than the selected constructor.
1 open issue
What changed in this PR
This PR addresses incorrect initial debugger stops when stepping into constructors that read instance fields before super() under Java 28 preview features.
Changes:
- Adds an extra step when constructor-entry line information matches the reported pattern.
- Enables preview features in the Java 28 test project and adds an early-field-read fixture.
- Registers regression coverage for step into, step over, and drop to frame.
| File | Description |
|---|---|
| org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java | Adds constructor-entry detection and corrective stepping for Java 28+. |
| org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AutomatedSuite.java | Registers the Java 28 stepping tests. |
| org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/tests/AbstractDebugTest.java | Enables Java 28 preview features and configures the fixture launch. |
| org.eclipse.jdt.debug.tests/tests/org/eclipse/jdt/debug/test/stepping/SteppingTestsForJava28.java | Tests constructor stepping and drop-to-frame line positions. |
| org.eclipse.jdt.debug.tests/java28/EarlyRead.java | Adds a constructor fixture that reads a field before super(). |
Review effort: Balanced
1281db0 to
1d0c989
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Constructor stepping lacks a bytecode-capability check, allowing UnsupportedOperationException to escape and potentially skip the expected suspension on unsupported Java 28+ targets.
1 open issue
1 resolved since last review
Review effort: Balanced
1d0c989 to
efc8e6e
Compare
There was a problem hiding this comment.
🟡 Changes recommended
The constructor workaround can misclassify a real first statement as synthetic initialization, causing Step Into to skip seed++ when line numbers legitimately decrease.
1 open issue
1 resolved since last review
Review effort: Balanced
JEP 401 (Java 28, preview) allows instance fields to be read in the early construction phase of a constructor, i.e. before super invocation: https://openjdk.org/jeps/401#Other-construction-enhancements When stepping into such a constructor on a Java 28, the first step suspends at a line after the first statement (e.g. the closing brace). A second step is needed to reach the first statement. Part of : eclipse-jdt#1051
efc8e6e to
5ab2440
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The shared stepping workaround depends on Java 28 preview bytecode and line-table patterns requiring live ECJ and javac validation of constructor entry, frame re-entry, and legitimate decreasing line numbers.
No open issues 🎉
1 resolved since last review
Review effort: Balanced


JEP 401 (Java 28, preview) allows instance fields to be read in the early construction phase of a constructor, i.e. before super invocation: https://openjdk.org/jeps/401#Other-construction-enhancements
When stepping into such a constructor on a Java 28, the first step suspends at a line after the first statement (e.g. the closing brace). A second step is needed to reach the first statement.
Part of : #1051
What it does
How to test
Author checklist