uschindler commented on code in PR #13087:
URL: https://github.com/apache/lucene/pull/13087#discussion_r1494397690


##########
lucene/CHANGES.txt:
##########
@@ -260,6 +260,8 @@ Improvements
 
 * GITHUB#13092: `static final Map` constants have been made immutable (Dmitry 
Cherniachenko)
 
+* GITHUB#13087: Some `static final Set` constants were mutable - rectified. 
(Dmitry Cherniachenko)

Review Comment:
   Move to 9.11



##########
lucene/core/src/java/org/apache/lucene/util/VirtualMethod.java:
##########
@@ -74,14 +73,13 @@
  */
 public final class VirtualMethod<C> {
 
-  private static final Set<Method> singletonSet =
-      Collections.synchronizedSet(new HashSet<Method>());
+  private static final Set<Method> singletonSet = 
ConcurrentHashMap.newKeySet();
 
   private final Class<C> baseClass;
   private final String method;
   private final Class<?>[] parameters;
   private final ClassValue<Integer> distanceOfClass =
-      new ClassValue<Integer>() {
+      new ClassValue<>() {

Review Comment:
   this is unrelated and does not work with Java 11 (when you subclass on "new" 
you had to be explicit in former times). I'd like to be explicit here.



##########
lucene/backward-codecs/src/test/org/apache/lucene/backward_index/BackwardsCompatibilityTestBase.java:
##########
@@ -80,7 +81,7 @@ public abstract class BackwardsCompatibilityTestBase extends 
LuceneTestCase {
       // make sure we never miss a version.
       assertTrue("Version: " + version + " missing", 
binaryVersions.remove(version));
     }
-    BINARY_SUPPORTED_VERSIONS = binaryVersions;
+    BINARY_SUPPORTED_VERSIONS = Collections.unmodifiableSet(binaryVersions);

Review Comment:
   We changed that code recently, maybe check also the other Ancient indexes 
test.



##########
lucene/core/src/java/org/apache/lucene/store/NativeFSLockFactory.java:
##########
@@ -65,7 +64,7 @@ public final class NativeFSLockFactory extends FSLockFactory {
   /** Singleton instance */
   public static final NativeFSLockFactory INSTANCE = new NativeFSLockFactory();
 
-  private static final Set<String> LOCK_HELD = Collections.synchronizedSet(new 
HashSet<String>());
+  private static final Set<String> LOCK_HELD = ConcurrentHashMap.newKeySet();

Review Comment:
   I think LOCK_HELP should be `Set<Path>`. This would make more sense as it 
would also be working with different slashes.
   
   I know this isn't related to this cleanup task, but I just have seen it.



##########
lucene/CHANGES.txt:
##########
@@ -260,6 +260,8 @@ Improvements
 
 * GITHUB#13092: `static final Map` constants have been made immutable (Dmitry 
Cherniachenko)
 
+* GITHUB#13087: Some `static final Set` constants were mutable - rectified. 
(Dmitry Cherniachenko)

Review Comment:
   Also add the new set impl.



-- 
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: issues-unsubscr...@lucene.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to