You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2021/09/10 19:27:02 UTC

[GitHub] [pulsar] michaeljmarshall opened a new pull request #12009: Use Lombok's @Builder.Default annotation to set defaults on fields in…

michaeljmarshall opened a new pull request #12009:
URL: https://github.com/apache/pulsar/pull/12009


   … TopicPolicies and Actions classes
   
   ### Motivation
   
   When using the `@Builder` annotation, default values must be annotated with the `@Builder.Default` annotation in order to get set to the default if not set by the code calling the builder methods. The modified code had some defaults that were getting ignored and some defaults that were unnecessary (setting objects to null).
   
   I found these issues when running `errorprone`. Here was the message: `java: @Builder will ignore the initializing expression entirely. If you want the initializing expression to serve as default, add @Builder.Default. If it is not supposed to be settable during building, make the field final.`
   
   ### Modifications
   
   * Update the `Actions` class to ensure that the defaults are set properly on `sleepBetweenInvocationsMs` and `numRetries`. The previous defaults would have been `0` for each field.
   * Update the `TopicPolicies` class in two ways. First, set ensure that the `backLogQuotaMap` and the `subscriptionTypesEnabled` are properly defaulted. There is code that could have resulted in an NPE without this fix. However that method isn't called right now, so this just  preventative. Second, remove the unnecessary assignment of objects to `null`. The builder will do this automatically if the field is not explicitly set.
   
   ### Verifying this change
   
   This is a trivial change. I am assuming that the values in the classes are correct and the right defaults to use.
   
   ### Does this pull request potentially affect one of the following parts:
   
   This is not a breaking change. It might change some behaviors, that will only be a change to the defaults.
   
   ### Documentation
   
   No doc updates required.


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] michaeljmarshall commented on pull request #12009: Use Lombok's @Builder.Default annotation to set defaults on fields in…

Posted by GitBox <gi...@apache.org>.
michaeljmarshall commented on pull request #12009:
URL: https://github.com/apache/pulsar/pull/12009#issuecomment-917200998


   /pulsarbot run-failure-checks


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [pulsar] lhotari merged pull request #12009: Use Lombok's @Builder.Default annotation to set defaults on fields in…

Posted by GitBox <gi...@apache.org>.
lhotari merged pull request #12009:
URL: https://github.com/apache/pulsar/pull/12009


   


-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org