maccamlc commented on a change in pull request #885:
URL: https://github.com/apache/avro/pull/885#discussion_r711495284
##########
File path: lang/java/avro/src/main/java/org/apache/avro/LogicalTypes.java
##########
@@ -51,9 +65,27 @@ default String getTypeName() {
public static void register(String logicalTypeName, LogicalTypeFactory
factory) {
Objects.requireNonNull(logicalTypeName, "Logical type name cannot be
null");
Objects.requireNonNull(factory, "Logical type factory cannot be null");
+
+ try {
+ String factoryTypeName = factory.getTypeName();
+ if (!logicalTypeName.equals(factoryTypeName)) {
+ throw new IllegalArgumentException(String.format(
Review comment:
Just in case if there is a difference, updated the Specific Compiler to
use the method that takes the string key and the factory when generating code.
Technically shouldn't be an issue, as to use a custom logic type factory in
the maven plugin, it requires the type name. But seems safer this way for now
to me
--
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]