Copilot commented on code in PR #15633: URL: https://github.com/apache/dubbo/pull/15633#discussion_r2280078208
########## dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/DefaultServiceInstance.java: ########## @@ -305,28 +315,61 @@ public boolean equals(Object o) { return false; } DefaultServiceInstance that = (DefaultServiceInstance) o; - boolean equals = Objects.equals(getServiceName(), that.getServiceName()) - && Objects.equals(getHost(), that.getHost()) - && Objects.equals(getPort(), that.getPort()); - for (Map.Entry<String, String> entry : this.getMetadata().entrySet()) { - if (entry.getKey().equals(EXPORTED_SERVICES_REVISION_PROPERTY_NAME)) { + if (!Objects.equals(getServiceName(), that.getServiceName()) + || !Objects.equals(getHost(), that.getHost()) + || !Objects.equals(getPort(), that.getPort())) { + return false; + } + + // compare entry values by iterating over two sorted metadata maps in a single pass. + Iterator<Entry<String, String>> iterThis = + this.getSortedMetadata().entrySet().iterator(); + Iterator<Map.Entry<String, String>> iterThat = Review Comment: Inconsistent generic type declarations between the two iterators. Line 325 uses `Iterator<Entry<String, String>>` while this line uses `Iterator<Map.Entry<String, String>>`. Both should use the same type for consistency. ```suggestion Iterator<Entry<String, String>> iterThat = ``` -- 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: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org