Skip to content

UseLombokGetter and UseLombokSetter recipes replace instance methods for static fields with static methods #870

@maikebertpsc

Description

@maikebertpsc

What version of OpenRewrite are you using?

I am using

  • rewrite-java 8.62.6

What is the smallest, simplest way to reproduce the problem?

class A {
    static int field;
    int getField() {
        return field;
    }
}

What did you expect to see?

class A {
    static int field;
    int getField() {
        return field;
    }
}

It should not modify the code at all.

What did you see instead?

import lombok.Getter;

class A {
    @Getter
    static int field;
}

This does result in the Lombok generated code:

class A {
    static int field;
    static int getField() {
        return field;
    }
}

which is not the same as before and therefore invalid.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingrecipeRecipe requested

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions