THRIFT-5274 - Thrift 0.13.0 does not work with JDK8#2231
Conversation
|
Hi @he , I have been using jdk-8 for thrift communication and compilation, but I have not found java.lang.NoSuchMethodError. Can you provide test cases? Cheers, |
|
Hi @zeshuai007 , Yes you can reproduce as follows:
If you run the last command with JDK11 it works perfectly, otherwise you start seeing the errors as above, e.g.: |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
|
@zeshuai007 Will this PR be considered for 0.14.0? Or can you at least make sure that released artifacts are built with Java 8 to avoid this problem? |
|
This issue is no longer stale. Thank you for your contributions. |
|
A much simpler fix would be to add |
Thrift 0.13.0 does not work with JDK8, as it is compiled with JDK11. Even though the source version is JDK8, incorrect byte code is generated for various ByteBuffer methods, e.g.:
Exception in thread "TAsyncClientManager#SelectorThread 22" java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer;
The fix is to manually cast ByteBuffer to Buffer (or else switch to using the xenial docker image to create the release artifacts). See this task for more context: jetty/jetty.project#3244