Skip to content

TreeMaker and WorkingCopy fail to persist RECORD kind for ClassTree during modification tasks. #9354

@priyanahata

Description

@priyanahata

Apache NetBeans version

Apache NetBeans 29

What happened

Steps to Reproduce:

In a runModificationTask, create a ClassTree using make.Class where the ModifiersTree contains the RECORD flag (bit 61) or parse a record string using TreeUtilities.parseTypeDecls.
Verify tree.getKind() returns Tree.Kind.RECORD.
Verify tree.toString() incorrectly renders the keyword as class.
Commit the change using wc.rewrite(oldParent, updatedParent).

Result: The record is written to the source file as a class, losing its record semantics and converting components to fields.

Expected: The keyword record should be used if getKind() == RECORD.

Language / Project Type / NetBeans Component

Java Maven Project

How to reproduce

In a runModificationTask, create a ClassTree using make.Class where the ModifiersTree contains the RECORD flag (bit 61) or parse a record string using TreeUtilities.parseTypeDecls.
Verify tree.getKind() returns Tree.Kind.RECORD.
Verify tree.toString() incorrectly renders the keyword as class.
Commit the change using wc.rewrite(oldParent, updatedParent).

Did this work correctly in an earlier version?

No / Don't know

Operating System

ubuntu

JDK

25

Apache NetBeans packaging

Community provided installer

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)kind:bugBug report or fixneeds:triageRequires attention from one of the committers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions