ppkarwasz commented on issue #2769:
URL: 
https://github.com/apache/logging-log4j2/issues/2769#issuecomment-2472576512

   @jaykataria1111,
   
   > I am writing an [OpenRewrite](https://docs.openrewrite.org/) recipe for 
the general setters, going to take a dependency for OpenRewrite for the 
purpose, wanted to share as an FYI. hope taking dependencies is fine.
   
   That is great! Note that the general problem of moving an annotation from a 
field to a getter or setter is not Log4j-specific: most dependency injection 
frameworks (JAXB, JPA, JSR 330, Spring) allow users to annotate fields, getters 
or setters.
   The best place for such a rule would be OpenRewrite itself, probably the 
[openrewrite/rewrite-migrate-java](https://github.com/openrewrite/rewrite-migrate-java)
 repository.
   We will apply the rule as a one off operation.
   
   @timtebeek, do you have any recommendations on how to rewrite:
   
   ```java
   public static class Builder implements Supplier<ConsoleAppender> {
   
       @PluginBuilderAttribute
       private boolean follow;
   
       public Builder setFollow(boolean follow) {
           this.follow = follow;
           return this;
       }
   }
   ```
   
   to
   
   ```java
   public static class Builder implements Supplier<ConsoleAppender> {
   
       private boolean follow;
   
       public Builder setFollow(@PluginAttribute boolean follow) {
           this.follow = follow;
           return this;
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to