-
Notifications
You must be signed in to change notification settings - Fork 926
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
Use SELF for Builder Self Type Parameter (part2) #5733
Conversation
Motivation: See line#5684 for the motivation. Modifications: - Refactored builder classes to use the SELF type parameter for the builder's self-referencing methods. Result: - Reduced the need for cumbersome and error-prone method overrides.
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.
Agree with the overall direction 👍 I'd rather not go through each change since I think it's more efficient that we fix them as we go along. Thanks @minwoox 🙇 👍 🙇
@@ -92,6 +92,14 @@ public abstract class AbstractDnsResolverBuilder { | |||
*/ | |||
protected AbstractDnsResolverBuilder() {} | |||
|
|||
/** | |||
* Return this. |
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.
Global comment:
* Return this. | |
* Returns {@code this}. |
@@ -36,7 +36,9 @@ | |||
* @param <T> the response type | |||
*/ | |||
@UnstableApi | |||
public abstract class AbstractRuleWithContentBuilder<T extends Response> extends AbstractRuleBuilder { | |||
public abstract class AbstractRuleWithContentBuilder | |||
<T extends Response, SELF extends AbstractRuleWithContentBuilder<T, SELF>> |
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.
Global comment: Maybe SELF
should come first?
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.
Thanks! Updated. 👍
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.
Thanks, @minwoox!
Motivation: See line#5684 for the motivation. Modifications: - Refactored builder classes to use the SELF type parameter for the builder's self-referencing methods. Result: - Reduced the need for cumbersome and error-prone method overrides. - (Breaking) These are all annotated with `@UnstableApi`. - `AbstractDnsResolverBuilder` is now `AbstractDnsResolverBuilder<SELF>` - `AbstractRuleBuilder` is now `AbstractRuleBuilder<SELF>` - `AbstractRuleWithContentBuilder` is now `AbstractRuleWithContentBuilder<SELF>` - `AbstractCircuitBreakerMappingBuilder` is now `AbstractCircuitBreakerMappingBuilder<SELF>` - `AbstractDynamicEndpointGroupBuilder` is now `AbstractDynamicEndpointGroupBuilder<SELF>` - `DynamicEndpointGroupSetters` is now `DynamicEndpointGroupSetters<SELF>` - `AbstractCuratorFrameworkBuilder` is now `AbstractCuratorFrameworkBuilder<SELF>`
Motivation:
See #5684 for the motivation.
Modifications:
Result:
@UnstableApi
.AbstractDnsResolverBuilder
is nowAbstractDnsResolverBuilder<SELF>
AbstractRuleBuilder
is nowAbstractRuleBuilder<SELF>
AbstractRuleWithContentBuilder
is nowAbstractRuleWithContentBuilder<SELF>
AbstractCircuitBreakerMappingBuilder
is nowAbstractCircuitBreakerMappingBuilder<SELF>
AbstractDynamicEndpointGroupBuilder
is nowAbstractDynamicEndpointGroupBuilder<SELF>
DynamicEndpointGroupSetters
is nowDynamicEndpointGroupSetters<SELF>
AbstractCuratorFrameworkBuilder
is nowAbstractCuratorFrameworkBuilder<SELF>