Skip to content

Fields colored as identifiers in pattern switch cases #8475

Open
@mrj760

Description

@mrj760

Apache NetBeans version

Apache NetBeans 25

What happened

I am using Flatlaf Dark.
When doing the following...

private class Foo {
    private int field1, field2;
    private static int stat1, stat2;

    private void doFoo() {
        switch(this) {
            case Foo foo -> {
                field1 = 5;
                field2 = 10;
            }
        }
    }

    private void doFooStat() {
        switch(this) {
            case Foo foo -> {
                stat1 = 5;
                stat2 = 10;
            }
        }
    }
}

field1 will be colored white (the standard color for identifiers).
field2 will be colored purple (the standard color for member/static fields).

The same thing happens regardless if it's a static or member field, and regardless if this or a class reference is used.

I saw this same issue in NB21 as well so it's been pervasive.

Language / Project Type / NetBeans Component

No response

How to reproduce

See above

Did this work correctly in an earlier version?

No / Don't know

Operating System

Win10

JDK

JDK21

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

No response

Are you willing to submit a pull request?

No

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions