gax-java
gax-java copied to clipboard
Consider removing abstract toBuilder
Gax uses a pattern of abstract <B extends Builder<SettingsT, B>> B toBuilder();
in a base class, expecting a subclass to override it with a concrete return type.
This causes warnings like:
BigtableTableAdminStubSettings.java:[764,43] build() in com.google.cloud.bigtable.admin.v2.stub.BigtableTableAdminStubSettings.Builder overrides <B>build() in com.google.api.gax.rpc.StubSettings.Builder
return type requires unchecked conversion from com.google.cloud.bigtable.admin.v2.stub.BigtableTableAdminStubSettings to com.google.api.gax.rpc.StubSettings<B>
It might be cleaner remove the abstract toBuilder() method from the base classes and trust that the subclasses will implement that method
@garrettjonesgoogle can you take a look at this?
It seems like it should be possible to fix the parameterization to get this to work...
I don't think this is possible. The base class's toBuilder return type would have to include a self referential parameter that includes its builder class, which will be an inner class that hasn't been defined yet.
This is likely an API breaking change and a major version update. Is it worth that?
I don’t think it’s worth doing a major version bump for this, but I would argue that if a major version were to happen, this should be included. Maybe this can be included in a v2 hotlist? (Along with making ClientContext internal)
We missed the opportunity for v2 — is this still worth doing at the next breaking change?
I'm not sure when we'll have the next major version bump, but yes, it would have to be filed under that.