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 with Java9 Builds #36

Closed
7 tasks done
jordanpadams opened this issue Apr 7, 2021 · 0 comments · Fixed by #37
Closed
7 tasks done

NoSuchMethodError: java.nio.ByteBuffer with Java9 Builds #36

jordanpadams opened this issue Apr 7, 2021 · 0 comments · Fixed by #37
Assignees
Labels
B11.1 bug Something isn't working s.medium

Comments

@jordanpadams
Copy link
Member

jordanpadams commented Apr 7, 2021

🐛 Describe the bug

Per jetty/jetty.project#3244

Like many other projects (Tomcat, MongoDB, etc.) compiling with JDK 9+ with release 8 produces incorrect bytecode for these ByteBuffer methods:

  • position(int)
  • limit(int) None
  • mark​()
  • reset​()
  • clear()
  • flip()
  • rewind​()

Running a Jetty compiled with JDK 9+ with release 8 in a JDK 8 JVM will produce a NoSuchMethodError.

The solution is to cast the ByteBuffer to Buffer when calling those methods:

((Buffer)byteBuffer).position(0);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B11.1 bug Something isn't working s.medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant