Skip to content

Breakpoint inside record methods don't work #973

Closed
microsoft/java-debug
#370
@gmiscione

Description

If you create a method inside a record (preview feature of Java 15) and you try to place a breakpoint into that method, the debugger is not able to stop at the location.

Environment
  • Operating System: Ubuntu 18.04.5
  • JDK version: 15.0.1 with preview features
  • Visual Studio Code version: code-server v3.9.2 with VSCode v1.54.2
  • Java extension version: 0.76.0
  • Java Debugger extension version: 0.32.1
Steps To Reproduce
  1. Create a record class with a method
  2. Place a breakpoint into that method
  3. Create a main class that calls the method that contains the breakpoint
  4. Launch the main class in debug mode
Code example
public class RecordTest {
    public static void main(String[] args) throws Exception {
        var rec = new TestRecord(7, 6, 8, 2);
        int res = rec.evenMinTimes2();
        System.out.println(res);
    }

    public static record TestRecord(int v1, int v2, int v3, int v4) {
        public int evenMinTimes2() {
            int res = IntStream.of(v1, v2, v3, v4) //
                    .filter(v -> v % 2 == 0) //
                    .min() //
                    .orElseThrow();
            res *= 2; // place breakpoint here, for example
            return res;
        }
    }
}
Current Result

Execution should stop at the breakpoint

Expected Result

Breakpoint is ignored and execution goes past it

Additional Informations

If you place a breakpoint in the main method and you switch to the record class, the breakpoint icon is replaced with an hollow circle and the tooltip says "Unverified breakpoint". Moreover, if you step-in into the method, the debugger is able to go over each instruction step by step.

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions