Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer #29

Closed
ksafonov opened this issue Dec 17, 2021 · 4 comments
Closed

Comments

@ksafonov
Copy link

Hi, I'm getting
java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
at com.esaulpaugh.headlong.abi.TupleType.decodeObjects(TupleType.java:197)
at com.esaulpaugh.headlong.abi.TupleType.decode(TupleType.java:172)
at com.esaulpaugh.headlong.abi.Function.decodeCall(Function.java:236)
at com.esaulpaugh.headlong.abi.Function.decodeCall(Function.java:218)

when using headlong 5.6.0 from Maven central on Java 1.8.0_45.

If you plan to support Java 8 (as readme says) please consider building using maven.compiler.release=0 (see e.g. https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/).

@esaulpaugh
Copy link
Owner

I'm having trouble reproducing the error. https://github.com/esaulpaugh/headlong-cli uses 5.6.0 but as it's currently configured, it isn't producing the error.

It uses <source>8</source> and <target>8</target>. Is that what you're using?

@esaulpaugh
Copy link
Owner

esaulpaugh commented Dec 17, 2021

Nevermind. I am seeing the error now. My tests weren't reaching that line. I do not know why my releases are not compiling correctly. I am using

sourceCompatibility = 1.8
targetCompatibility = 1.8

compileJava {
    if (!Jvm.current().getJavaVersion().isCompatibleWith(JavaVersion.VERSION_1_8)) {
        options.compilerArgs.addAll(['--release', '8'])
    }
}

While I figure out why gradle is failing to perform as expected, I will probably release a 5.6.1 compiled with JDK 1.8.

@esaulpaugh
Copy link
Owner

@esaulpaugh esaulpaugh pinned this issue Dec 18, 2021
@ksafonov
Copy link
Author

Thank you!

@esaulpaugh esaulpaugh unpinned this issue Feb 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants