Skip to content

Static import hint not offered inside record class #9166

@nmatt

Description

@nmatt

Apache NetBeans version

Apache NetBeans 28

What happened

The hint to add an import for a static method is not offered inside record classes.

Language / Project Type / NetBeans Component

Java, Hints

How to reproduce

Example:

record Example(String name)
{
    Example { Objects.requireNonNull(name); }
    void f() { System.currentTimeMillis(); }
}

=> No static-import hint is offered for requireNonNull() and currentTimeMillis().

Compare to the case of a regular class:

class Example
{
    Example(String name) { Objects.requireNonNull(name); }
    void f() { System.currentTimeMillis(); }
}

Did this work correctly in an earlier version?

No / Don't know

Operating System

Windows

JDK

JDK 21

Apache NetBeans packaging

Apache NetBeans binary zip

Anything else

No response

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

    Java[ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form)hintskind:bugBug report or fix

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions