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


##########
lucene/core/src/java/org/apache/lucene/store/RefCountedSharedArena.java:
##########
@@ -49,6 +51,17 @@ final class RefCountedSharedArena implements Arena {
   // acquire decrement; effectively decrements permits and increments ref count
   private static final int ACQUIRE_DECREMENT = REMAINING_UNIT - 1; // 0xffff
 
+  /** True iff JVM assertions are enabled for this class. */
+  private static final boolean ASSERTS_ENABLED;
+
+  /** Cleaner only created when assertions are enabled (avoids overhead 
otherwise). */
+  private static final Cleaner CLEANER;
+
+  static {
+    ASSERTS_ENABLED = RefCountedSharedArena.class.desiredAssertionStatus();

Review Comment:
   I'd prefer not to use that function and use the assert keyword to trigger 
this:
   
   ```
   boolean enabled;
   assert enabled = true;
   ASSERTS_ENABLED = enabled;
   ```



##########
lucene/core/src/java/org/apache/lucene/store/RefCountedSharedArena.java:
##########
@@ -49,6 +51,17 @@ final class RefCountedSharedArena implements Arena {
   // acquire decrement; effectively decrements permits and increments ref count
   private static final int ACQUIRE_DECREMENT = REMAINING_UNIT - 1; // 0xffff
 
+  /** True iff JVM assertions are enabled for this class. */
+  private static final boolean ASSERTS_ENABLED;
+
+  /** Cleaner only created when assertions are enabled (avoids overhead 
otherwise). */
+  private static final Cleaner CLEANER;
+
+  static {
+    ASSERTS_ENABLED = RefCountedSharedArena.class.desiredAssertionStatus();

Review Comment:
   I'd prefer not to use that function and use the assert keyword to trigger 
this:
   
   ```java
   boolean enabled;
   assert enabled = true;
   ASSERTS_ENABLED = enabled;
   ```



-- 
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