-
Notifications
You must be signed in to change notification settings - Fork 77
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
feat: summarize method level getter and setter annotations to one class level annotation #633
base: main
Are you sure you want to change the base?
Conversation
src/main/java/org/openrewrite/java/migrate/lombok/SummarizeGetter.java
Outdated
Show resolved
Hide resolved
return annotation.getSimpleName().equals("Getter") | ||
&& annotation.getArguments() == null //no Access level, or other arguments | ||
//should only trigger on field annotation, not class annotation | ||
&& getCursor().getParent().getValue() instanceof J.VariableDeclarations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return annotation.getSimpleName().equals("Getter") | |
&& annotation.getArguments() == null //no Access level, or other arguments | |
//should only trigger on field annotation, not class annotation | |
&& getCursor().getParent().getValue() instanceof J.VariableDeclarations | |
return annotation.getSimpleName().equals("Getter") && | |
annotation.getArguments() == null //no Access level, or other arguments | |
&& getCursor().getParent().getValue() instanceof J.VariableDeclarations ? | |
null // -> delete |
src/main/java/org/openrewrite/java/migrate/lombok/SummarizeSetter.java
Outdated
Show resolved
Hide resolved
src/main/java/org/openrewrite/java/migrate/lombok/SummarizeSetter.java
Outdated
Show resolved
Hide resolved
boolean isSetterAnnotated = annotation.getSimpleName().equals("Setter") | ||
&& annotation.getArguments() == null; //no Access level, or other arguments | ||
|
||
return isSetterAnnotated | ||
//should only trigger on field annotation, not class annotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean isSetterAnnotated = annotation.getSimpleName().equals("Setter") | |
&& annotation.getArguments() == null; //no Access level, or other arguments | |
return isSetterAnnotated | |
//should only trigger on field annotation, not class annotation | |
boolean isSetterAnnotated = annotation.getSimpleName().equals("Setter") && | |
annotation.getArguments() == null; //no Access level, or other arguments | |
return isSetterAnnotated //should only trigger on field annotation, not class annotation | |
&& | |
getCursor().getParent().getValue() instanceof J.VariableDeclarations ? | |
null // -> delete |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
return annotation.getSimpleName().equals("Getter") | ||
&& annotation.getArguments() == null //no Access level, or other arguments | ||
//should only trigger on field annotation, not class annotation | ||
&& getCursor().getParent().getValue() instanceof J.VariableDeclarations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return annotation.getSimpleName().equals("Getter") | |
&& annotation.getArguments() == null //no Access level, or other arguments | |
//should only trigger on field annotation, not class annotation | |
&& getCursor().getParent().getValue() instanceof J.VariableDeclarations | |
return annotation.getSimpleName().equals("Getter") && | |
annotation.getArguments() == null //no Access level, or other arguments | |
&& getCursor().getParent().getValue() instanceof J.VariableDeclarations ? | |
null // -> delete |
boolean isSetterAnnotated = annotation.getSimpleName().equals("Setter") | ||
&& annotation.getArguments() == null; //no Access level, or other arguments | ||
|
||
return isSetterAnnotated | ||
//should only trigger on field annotation, not class annotation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
boolean isSetterAnnotated = annotation.getSimpleName().equals("Setter") | |
&& annotation.getArguments() == null; //no Access level, or other arguments | |
return isSetterAnnotated | |
//should only trigger on field annotation, not class annotation | |
boolean isSetterAnnotated = annotation.getSimpleName().equals("Setter") && | |
annotation.getArguments() == null; //no Access level, or other arguments | |
return isSetterAnnotated //should only trigger on field annotation, not class annotation | |
&& | |
getCursor().getParent().getValue() instanceof J.VariableDeclarations ? | |
null // -> delete |
Anything in particular you'd like reviewers to focus on?
Anyone you would like to review specifically?
Have you considered any alternatives or workarounds?
Any additional context
Checklist