Skip to content

JDT Debugger: "Method undefined" error for inherited methods in JDK 17/21/25 classes #923

@mego77777

Description

@mego77777

In Eclipse IDE (Version 2026-03; сlean IDE install: just extracted, no plugins, and a newly created workspace), the Expression Evaluator fails to resolve inherited methods when a breakpoint is set inside a system module class (e.g., javax.swing.JFormattedTextField). Even though the class hierarchy is correctly shown in the Type Hierarchy view, the debugger claims that methods from parent classes (like getName() or getParent() from java.awt.Component) are undefined.

Steps to reproduce

  1. Use Oracle JDK 21 JDK 17 or JDK 25 or embedded/bundled JDK.
  2. Create a clean Java project in IDE (no Gradle/Maven); See the test code below .
  3. Set a breakpoint inside javax.swing.JFormattedTextField.JFormattedTextField() source code.
  4. Add an expression: "getName()".
  5. Start debugging.

Actual Result:

<error(s)_during_the_evaluation>: The method getName() is undefined for the type JFormattedTextField
<error(s)_during_the_evaluation>: The method isVisible() is undefined for the type JFormattedTextField
<error(s)_during_the_evaluation>: The method getParent() is undefined for the type JFormattedTextField

Image

Expected Result:

The debugger should resolve inherited methods from java.awt.Component and javax.swing.JComponent

Workaround found:

Explicit casting via Object or Dynamic casting using the Class.cast() method works:

  1. ((java.awt.Component)(Object)this).getName().
  2. java.awt.Component.class.cast(this).getName()

This suggests a failure in the JDT Debug implicit type resolution for modular JRE classes.

Test code:

public class bbb {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            JFrame frame = new JFrame("test");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setSize(300, 150);
            frame.setLayout(new FlowLayout());
            
            JFormattedTextField formattedField = new JFormattedTextField();
            frame.add(formattedField);

            frame.setLocationRelativeTo(null); 
            frame.setVisible(true);
        });
    }
}

Environment:

Eclipse IDE 2026-03; Version: 2026-03 (4.39.0); Build id: 20260305-0817
Java Version: Oracle JDK 17.0.1 / 21.0.9 / JDK 25.0.2 / Embedded OpenJDK Runtime Environment 21.0.10+7-LTS
OS: Windows 10 Pro 22H2, (10.0.19045.6456)
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions