[ https://issues.apache.org/jira/browse/THRIFT-5274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17258310#comment-17258310 ]
Christopher Tubbs edited comment on THRIFT-5274 at 1/4/21, 4:37 PM: -------------------------------------------------------------------- The correct solution here is to add {{-release 8}} to the {{javac}} command line when building with JDK9 and later. If it's a Maven project, the best way to do this is to use a recent version of {{maven-compiler-plugin}}, and set {{<maven.compiler.release>8</maven.compiler.release>}} in the {{<properties>}} section of the {{pom.xml}} or on the command-line with {{-Dmaven.compiler.release=8}}. Here's one way to do it with a Maven profile that is automatically activated when using a newer JDK: {code:xml} <profile> <id>jdk-release-flag</id> <activation> <jdk>[9,)</jdk> </activation> <properties> <maven.compiler.release>8</maven.compiler.release> </properties> </profile> {code} was (Author: ctubbsii): The correct solution here is to add {{-release 8}} to the {{javac}} command line when building with JDK9 and later. If it's a Maven project, the best way to do this is to use a recent version of {{maven-compiler-plugin}}, and set {{<maven.compiler.release>8</maven.compiler.release>}} in the {{<properties>}} section of the {{pom.xml}} or on the command-line with {{-Dmaven.compiler.release=8}}. Here's one way to do it with a Maven profile that is automatically activated when using a newer JDK: {code} <profile> <id>jdk-release-flag</id> <activation> <jdk>[9,)</jdk> </activation> <properties> <maven.compiler.release>8</maven.compiler.release> </properties> </profile> {code} > Thrift 0.13.0 does not work with JDK8 > ------------------------------------- > > Key: THRIFT-5274 > URL: https://issues.apache.org/jira/browse/THRIFT-5274 > Project: Thrift > Issue Type: Task > Reporter: Colm O hEigeartaigh > Priority: Major > Fix For: 0.14.0 > > Time Spent: 2h 20m > Remaining Estimate: 0h > > 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 suggested in this blog post: > [https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/] > We can add the release flag for 1.8 (--release=8). -- This message was sent by Atlassian Jira (v8.3.4#803005)