murat8505 / projectlombok

Automatically exported from code.google.com/p/projectlombok
0 stars 1 forks source link

@ToString, if field does not exist, shows a warning, even if the using getters and/or field exists in super class and is protected or public #800

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Add an @ToString annotation to a class that extends another.
2. In "of" specify a property that exists in the parent class.
3. See warning on @ToString annotation

Example classes:

@Getter
public class Foo {
    private String id;
}

@Getter
@ToString("id","name")
public class FooBar extends Foo{
   private String name;
}

What is the expected output? 

No warning on @ToString.
A toString() method generated using the id and name.

What do you see instead?

An unnecessary warning on the @ToString annotation.

What version of the product are you using? On what operating system?

1.12.6, Windows 7, Centos 6.5, Lubuntu 14.4

Please provide any additional information below.

Since I am not specifying the flag doNotUseGetters=true on @ToString and a 
getter for id is publically available from the superclass, the warning on the 
annotation is meaningless in that case.

Can the super class be checked for a getter or a protected/public instance for 
the field during the generation of the toString method instead of showing this 
error?

Original issue reported on code.google.com by j...@percsolutions.com on 20 Mar 2015 at 11:52