Skip to content

Support lombok getter/setter generation for multiple variables declared on a single line #876

@rojyates

Description

@rojyates

What problem are you trying to solve?

The current Lombok AddGetter and AddSetter recipes do not handle compound field declarations like:
private int x, y, z;

Describe the solution you'd like

Automatically split compound declarations into individual fields.
Generate getters and setters for each field.

Have you considered any alternatives or workarounds?

The workaround is to manually edit the affected files to split the variables onto separate lines.

An alternative would be:

  • integrate SplitVariableDeclarations into the getter/setter recipes.
  • ensure each field from a compound declaration receives its own accessor methods.

Additional context

Are you interested in contributing this feature to OpenRewrite?

If time permits later but not at the moment.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions