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

[Suggestion] Override Getter/Setter annotations #1026

Closed
delverdev opened this issue Feb 15, 2016 · 3 comments
Closed

[Suggestion] Override Getter/Setter annotations #1026

delverdev opened this issue Feb 15, 2016 · 3 comments

Comments

@delverdev
Copy link

It would be nice if you would implement overriding getter/setter annotations. For example:

@Getter
public class Example {

    private int a;

    public int getA() { //override to avoid npe
         return a < 0 ? -1 : a; 
    }    

}
@Maaartinus
Copy link
Contributor

Just do it. No getter gets generated if there's already one present.

You can also use @Getter(AccessLevel.NONE) to disable the generation explicitly.

@delverdev
Copy link
Author

Well then it is an issue of IntelliJ IDEA plugin, which warns me that I cannot have @Getter and simple getter together. Thank you for the answer!

@Maaartinus
Copy link
Contributor

AFAIK, there should be no such warning unless the annotation surely generates no getters at all (a field-level annotation together with the manual getter should produce a warning; a class-level annotation should not).

@Rawi01 Rawi01 closed this as completed Feb 21, 2022
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

3 participants