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

Fixed NoSuchMethodError when parsing a JSON stream on Java 8 #2328

Merged
merged 2 commits into from
Jun 13, 2023

Conversation

shanshin
Copy link
Contributor

@shanshin shanshin commented Jun 12, 2023

Fixed NoSuchMethodError when parsing a JSON stream on Java 8

Fixes #2326

An explicit cast is needed here due to an API change in Java 9, see #2218.
In Java 8 and earlier, the position(I) method was final in Buffer, and returned a Buffer.
In Java 9 and later, the method was opened, and ByteBuffer overrides it, returning a ByteBuffer.
This causes a NoSuchMethodError when running a class, compiled with a newer Java version, on Java 8.

Fixes #2326

An explicit cast is needed here due to an API change in Java 9, see #2218.
In Java 8 and earlier, the `position(I)` method was final in `Buffer`, and returned a `Buffer`.
In Java 9 and later, the method was opened, and `ByteFuffer` overrides it, returning a `ByteBuffer`.
This causes a `NoSuchMethodError` when running a class, compiled with a newer Java version, on Java 8.
@shanshin shanshin force-pushed the java8-streams branch 3 times, most recently from 307fa88 to 39fe976 Compare June 13, 2023 12:14
@shanshin shanshin merged commit a269f97 into dev Jun 13, 2023
3 checks passed
@shanshin shanshin deleted the java8-streams branch June 13, 2023 13:37
woainikk pushed a commit that referenced this pull request Jun 20, 2023
Fixes #2326

An explicit cast is needed here due to an API change in Java 9, see #2218.
In Java 8 and earlier, the `position(I)` method was final in `Buffer`, and returned a `Buffer`.
In Java 9 and later, the method was opened, and `ByteBuffer` overrides it, returning a `ByteBuffer`.
This causes a `NoSuchMethodError` when running a class, compiled with a newer Java version, on Java 8.
JesusMcCloud pushed a commit to a-sit-plus/kotlinx.serialization that referenced this pull request Jul 5, 2023
…2328)

Fixes Kotlin#2326

An explicit cast is needed here due to an API change in Java 9, see Kotlin#2218.
In Java 8 and earlier, the `position(I)` method was final in `Buffer`, and returned a `Buffer`.
In Java 9 and later, the method was opened, and `ByteBuffer` overrides it, returning a `ByteBuffer`.
This causes a `NoSuchMethodError` when running a class, compiled with a newer Java version, on Java 8.
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

Successfully merging this pull request may close these issues.

None yet

2 participants