You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/09/26 08:42:03 UTC

[GitHub] [pulsar] youzipi commented on a diff in pull request #17691: [cleanup][broker][Modernizer] fix violations in pulsar-broker

youzipi commented on code in PR #17691:
URL: https://github.com/apache/pulsar/pull/17691#discussion_r979728197


##########
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/ManagedCursor.java:
##########
@@ -18,13 +18,13 @@
  */
 package org.apache.bookkeeper.mledger;
 
-import com.google.common.base.Predicate;
 import com.google.common.collect.Range;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
 import java.util.concurrent.CompletableFuture;
+import java.util.function.Predicate;

Review Comment:
   
   ![image](https://user-images.githubusercontent.com/5629307/191921427-ad6aed69-3b26-447d-8c93-8be8535e0652.png)
   ```
    /Users/mac/projects/source_code/pulsar/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription$3.java:-1: Prefer java.util.function.Predicate
   ```
   
   here is the only one `guava Predicate` in PersistentSubscription, an anonymous class:
   https://github.com/apache/pulsar/blob/e73b29863614a210d14e105c26f691c29d0548d5/pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentSubscription.java#L558-L563
   
   ---
   moderinzer use ASM to  scan the class files and detect the latency usage.
   
   current rule only detect `implementing legacy interfaces`, see https://github.com/gaul/modernizer-maven-plugin/issues/1
   
   I build a test case and debug it,
   found that modernizer use a map to store all rules, and match with the class token by `absolutely equal`(not `contains`):
   
   ```java
   private final Map<String, Violation> violations;
   ...
   Violation violation = violations.get(token); 
   checkToken(token, violation, name, lineNumber);
   ```
   



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org