Skip to content

Lombok recipes should not remove getter/setter methods when the method body is referring to another classes' field #872

@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?

public class A {
								
	private class Sample {
		
		public Long number;
		
	}

	private class Inner {
		
		static Sample sample = null;

		private Long getNumber() {
				return sample.number;
		}
	}

}

What did you expect to see?

public class A {
								
	private class Sample {
		
		public Long number;
		
	}

	private class Inner {
		
		static Sample sample = null;

		private Long getNumber() {
				return sample.number;
		}
	}

}

It should not modify the code at all.

What did you see instead?

import lombok.Getter;

public class A {
								
	private class Sample {
		
		@Getter
		public Long number;
		
	}

	private class Inner {
		
		static Sample sample = null;

	}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions