zookeeper-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [zookeeper] symat commented on a change in pull request #1056: ZOOKEEPER-3495: fix SnapshotDigestTest to work with JDK12+
Date Fri, 16 Aug 2019 10:04:44 GMT
symat commented on a change in pull request #1056: ZOOKEEPER-3495: fix SnapshotDigestTest to
work with JDK12+
URL: https://github.com/apache/zookeeper/pull/1056#discussion_r314659210
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/util/DigestCalculator.java
 ##########
 @@ -37,19 +37,28 @@
 
     // The hardcoded digest version, should bump up this version whenever
     // we changed the digest method or fields.
-    //
-    // Defined it as Integer to make it able to be changed in test via reflection
-    public static final Integer DIGEST_VERSION = 2;
+    private static final int DIGEST_VERSION = 2;
 
+    public static final DigestCalculator DIGEST_CALCULATOR;
 
 Review comment:
   I think that would work too, and mocking is more elegant than using plain reflection in
the tests. (I think with Mockito you can even mock the class and you don't even need an intreface)
   
   The only issue with the removal of the `final` modifier is that from that point anywhere
from the production code you can easily change this singleton. But we can write a comment
that it is to be changed only from tests...
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message