xvrl commented on a change in pull request #7477: Java 9 compatible specialized class compilation URL: https://github.com/apache/incubator-druid/pull/7477#discussion_r276339661
########## File path: processing/src/main/java/org/apache/druid/query/monomorphicprocessing/SpecializationService.java ########## @@ -209,14 +349,20 @@ T specialize(ImmutableMap<Class<?>, Class<?>> classRemapping) @SuppressWarnings("unchecked") private Class<T> defineClass(String specializedClassName, byte[] specializedClassBytecode) { - return (Class<T>) UNSAFE.defineClass( - specializedClassName, - specializedClassBytecode, - 0, - specializedClassBytecode.length, - prototypeClass.getClassLoader(), - prototypeClass.getProtectionDomain() - ); + if (DEFINE_CLASS_NOT_SUPPORTED_EXCEPTION != null) { + throw new UnsupportedOperationException(DEFINE_CLASS_NOT_SUPPORTED_EXCEPTION); + } + + try { + return (Class<T>) DEFINE_CLASS.invokeExact( + prototypeClass, + specializedClassBytecode, + specializedClassName + ); + } + catch (Throwable t) { + throw new UnsupportedOperationException("Unable to define specialized class: " + specializedClassName, t); Review comment: I'm not sure what rule I broke then, since this fits into the line length ---------------------------------------------------------------- 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 With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org For additional commands, e-mail: commits-h...@druid.apache.org