uschindler commented on a change in pull request #1624: URL: https://github.com/apache/lucene-solr/pull/1624#discussion_r446632093
########## File path: solr/core/src/java/org/apache/solr/api/AnnotatedApi.java ########## @@ -87,16 +88,18 @@ public EndPoint getEndPoint() { public static List<Api> getApis(Object obj) { return getApis(obj.getClass(), obj); } - public static List<Api> getApis(Class<? extends Object> klas , Object obj) { - if (!Modifier.isPublic(klas.getModifiers())) { - throw new RuntimeException(klas.getName() + " is not public"); + public static List<Api> getApis(Class<? extends Object> theClass , Object obj) { + Class<?> klas = null; + try { + klas = MethodHandles.publicLookup().accessClass(theClass); + } catch (IllegalAccessException e) { + throw new RuntimeException(klas.getName() + " is not public", e); Review comment: Good catch. The code here is a mess, as you declare the variable as null. You should declare it final before catch block and not assign null. Then compiler would have been complained. The current code is a horrible antipattern. Always declare variables as final before try and assign once. ---------------------------------------------------------------- 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: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org