Skip to content

chore: resolve ambiguous method reference#8078

Merged
leah (lct45) merged 1 commit into
confluentinc:masterfrom
lct45:fix_kafka_sync
Aug 30, 2021
Merged

chore: resolve ambiguous method reference#8078
leah (lct45) merged 1 commit into
confluentinc:masterfrom
lct45:fix_kafka_sync

Conversation

@lct45

Copy link
Copy Markdown

In the jenkins job that builds ksql off the latest kafka, there were failures due to ambiguous method reference. In AK PR #9769, a new DescribeTopics method was added to Admin.java. This made our KafkaClientTopicImpl test fail because we mocked with any() in the DescribeTopics method call, which now map sto two methods -> describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) and
describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions)

This PR specifies that we should be looking for a Collection.

The test errors were:
[2021-08-29T16:07:40.085Z] [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile (default-testCompile) on project ksqldb-engine: Compilation failure: Compilation failure: [2021-08-29T16:07:40.085Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[112,21] reference to describeTopics is ambiguous [2021-08-29T16:07:40.085Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match [2021-08-29T16:07:40.085Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[196,21] reference to describeTopics is ambiguous [2021-08-29T16:07:40.086Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match [2021-08-29T16:07:40.086Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[205,34] reference to describeTopics is ambiguous [2021-08-29T16:07:40.086Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match [2021-08-29T16:07:40.086Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[282,21] reference to describeTopics is ambiguous [2021-08-29T16:07:40.086Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match [2021-08-29T16:07:40.086Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[291,34] reference to describeTopics is ambiguous [2021-08-29T16:07:40.086Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match [2021-08-29T16:07:40.086Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[297,21] reference to describeTopics is ambiguous [2021-08-29T16:07:40.086Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match [2021-08-29T16:07:40.086Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[314,21] reference to describeTopics is ambiguous [2021-08-29T16:07:40.086Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match [2021-08-29T16:07:40.086Z] [ERROR] /home/jenkins/workspace/apache-kafka-to-ksql-test_trunk/ksql-master/ksqldb-engine/src/test/java/io/confluent/ksql/services/KafkaTopicClientImplTest.java:[813,34] reference to describeTopics is ambiguous [2021-08-29T16:07:40.086Z] [ERROR] both method describeTopics(java.util.Collection<java.lang.String>,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin and method describeTopics(org.apache.kafka.common.TopicCollection,org.apache.kafka.clients.admin.DescribeTopicsOptions) in org.apache.kafka.clients.admin.Admin match

@lct45
leah (lct45) requested a review from a team as a code owner August 30, 2021 16:19

@vvcephei John Roesler (vvcephei) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, leah (@lct45) . This seems like it would work.

Another (maybe better) way is to actually bind the type, which you can do with a cast or using the argument matcher that takes a class reference. I'll leave it to you if you prefer that. I think it's fine either way.

@lct45 leah (lct45) changed the title chore: resolve ambiguous method reference fix: resolve ambiguous method reference Aug 30, 2021
@lct45 leah (lct45) changed the title fix: resolve ambiguous method reference chore: resolve ambiguous method reference Aug 30, 2021
@lct45

Copy link
Copy Markdown
Author

John Roesler (@vvcephei) I thought about doing that, the matcher that takes a class for anyCollectionOf was deprecated so I didn't opt for that. Would the cast be (String) collectionOf? Is the idea that this would be more secure than just collectionOf?

@lct45
leah (lct45) merged commit 0c0fb40 into confluentinc:master Aug 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants