Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@Data doesn't honor configuration keys for @ToString @EqualsAndHashCode #1329

Closed
sinuhepop opened this issue Mar 9, 2017 · 3 comments
Closed

Comments

@sinuhepop
Copy link

As a example, let's have these classes:

public class Test {
	public static void main(String... args) {
		System.out.println(new A("a"));
		System.out.println(new B("b"));
	}
}
@ToString
@RequiredArgsConstructor
public class A {
	private final String x;

	public String getX() {
		System.out.println("getX() invoked on " + this.getClass());
		return x;
	}
}
@Data
public class B {
	private final String x;

	public String getX() {
		System.out.println("getX() invoked on " + this.getClass());
		return x;
	}
}

And a lombok.config file:

config.stopBubbling = true
lombok.toString.doNotUseGetters = true

Execution prints:

A(x=a)
getX() invoked on class lombok.test.B
B(x=b)

So, property lombok.toString.doNotUseGetters isn't read by @Data. Maybe it's not a bug, but a wanted functionality. I probably won't agree with that, but I think at least som property like lombok.data.toString.doNotUseGetters is needed. Same happens for other properties of @ToString and @EqualsAndHashCode, but not for @Getter/@Setter.

@rspilker
Copy link
Collaborator

Fixed in 969ed91

@rspilker
Copy link
Collaborator

Thanks for bringing this up.

@sinuhepop
Copy link
Author

Thanks to you, guys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants