danmuzi commented on code in PR #15864:
URL: https://github.com/apache/lucene/pull/15864#discussion_r2976488493


##########
lucene/core/src/java/org/apache/lucene/internal/tests/TestSecrets.java:
##########
@@ -143,6 +129,14 @@ public static void 
setFilterInputIndexAccess(FilterIndexInputAccess filterIndexI
     TestSecrets.filterIndexInputAccess = filterIndexInputAccess;
   }
 
+  private static void ensureInitialized(Class<?> clazz) {
+    try {
+      MethodHandles.lookup().ensureInitialized(clazz);
+    } catch (IllegalAccessException e) {
+      throw new RuntimeException(e);

Review Comment:
   ```java
   // MethodHandles.java
   public <T> Class<T> ensureInitialized(Class<T> targetClass) throws 
IllegalAccessException {
       if (targetClass.isPrimitive())
           throw new IllegalArgumentException(targetClass + " is a primitive 
class");
       if (targetClass.isArray())
           throw new IllegalArgumentException(targetClass + " is an array 
class");
   
       if (!VerifyAccess.isClassAccessible(targetClass, lookupClass, 
prevLookupClass, allowedModes)) {
           throw makeAccessException(targetClass);
       }
   
       // ensure class initialization
       Unsafe.getUnsafe().ensureClassInitialized(targetClass);
       return targetClass;
   }
   ```
   
   Given the situation, there seems to be no way to avoid this exception 
handling.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to