bvolpato commented on code in PR #28825:
URL: https://github.com/apache/beam/pull/28825#discussion_r1356024314
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/coders/CoderProviders.java:
##########
@@ -178,7 +178,9 @@ public CoderProviderForCoder(TypeDescriptor<?> type,
Coder<?> coder) {
@Override
public <T> Coder<T> coderFor(TypeDescriptor<T> type, List<? extends
Coder<?>> componentCoders)
throws CannotProvideCoderException {
- if (!this.type.equals(type)) {
+ if (!(this.type.equals(type)
+ || (type.getRawType().getName().contains("AutoValue_")
+ && this.type.getRawType().isAssignableFrom(type.getRawType()))))
{
Review Comment:
nit this can be a bit hard to understand. maybe we can add some comments or
use variables to communicate the intent
```
boolean isTypeEqual = this.type.equals(type);
boolean isAutoValueConcrete =
type.getRawType().getName().contains("AutoValue_")
&&
this.type.getRawType().isAssignableFrom(type.getRawType());
if (!isTypeEqual && !isAutoValueConcrete) {
throw
}
```
--
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]