Details
Description
In java 11, this exception is thrown:
java.lang.IncompatibleClassChangeError: Inconsistent constant pool data in classfile for class org/apache/curator/framework/CuratorFramework. Method lambda$postSafeNotify$0(Ljava/lang/Object;)V at index 99 is CONSTANT_MethodRef and should be CONSTANT_InterfaceMethodRef
at org.apache.curator.framework.CuratorFramework.postSafeNotify(CuratorFramework.java:344)
at org.apache.curator.framework.recipes.locks.InterProcessSemaphoreV2$1.process(InterProcessSemaphoreV2.java:90)
at org.apache.curator.framework.imps.NamespaceWatcher.process(NamespaceWatcher.java:77)
at org.apache.zookeeper.ClientCnxn$EventThread.processEvent(ClientCnxn.java:533)
at org.apache.zookeeper.ClientCnxn$EventThread.run(ClientCnxn.java:508)
As I understood it, this is because there is a lambda in a default interface method and earlier versions of java 8 incorrectly compiled the method reference as a Method instead of an Interface method. Compiling with the latest java 8 compiler (8.0.172) seems to correctly compile the classin a way that works in java 8 and 11 (did not verify 9 and 10 but I suspect they behave like 11)