-
-
Notifications
You must be signed in to change notification settings - Fork 561
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
Javalin 6.1.0: java.lang.NoSuchMethodError: 'java.lang.Object java.util.List.removeFirst()'
when setting a cookie
#2117
Comments
Thanks @Jerbell - These |
|
Would be very surprising if we were using it then 🤔 The removeFirst that we are using is this: @SinceKotlin("1.4")
@WasExperimental(ExperimentalStdlibApi::class)
public fun <T> MutableList<T>.removeFirst(): T = if (isEmpty()) throw NoSuchElementException("List is empty.") else removeAt(0) |
As a guess without the background (or seeing the actual stack trace), with the maven-compiler-plugin / configuration instead of using https://github.com/javalin/javalin/blob/master/pom.xml#L306-L307 So change from: <configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration> To: <configuration>
<release>${jdk.version}</release>
</configuration> |
Oh, this is not fun... It's picking a new Java method instead of the Kotlin extension we're using? I could update the POM, but maybe it's safer to do @dzikoysk have you ran into this before? |
We could do both. I'd suggest we really should be using |
Did both in 7799662. |
Yes, this is caused by your setup - you've released Javalin that is targeted for JDK11 with JDK21. |
It seems like a pretty serious issue that all the Kotlin extensions can be hijacked by Java versions though... how do we guard against that in general? |
Releasing a build from the minimal required Java version is enough to avoid this kind of issues. For instance, I've set the jdk version on CI to 11, but it looks like zug bumped it 4 days ago, so snapshots builds are also affected now 😬 |
The last time I faced this issue I kinda forgot about this, but maybe this time it might be a good idea to report this on YouTrack. They already have a few similar issues, but maybe we can somehow push them to prioritize a fix at some point: |
Thanks everyone. |
- import kotlin.collections.removeFirst as removeFirstKt - Set <release> instead of <source> and <target> - Downgrade JTE to 2x
- import kotlin.collections.removeFirst as removeFirstKt - Set <release> instead of <source> and <target> - Downgrade JTE to 2x
…to 3.3.0 (#2127) * [context] Prevent unintended usage of JDK 21 feature (closes #2117) - Import import kotlin.collections.removeFirst as removeFirstKt - Set <release> instead of <source> and <target> * [tests] Add more ApiBuilder tests * [distribution] Revert 64ccbe1 and use JDK11 for snapshots GH-2117 (#2123) * [deps]: Bump kotlin.version from 1.9.10 to 1.9.22 (#2128) Bumps `kotlin.version` from 1.9.10 to 1.9.22. Updates `org.jetbrains.kotlin:kotlin-stdlib-jdk8` from 1.9.10 to 1.9.22 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](JetBrains/kotlin@v1.9.10...v1.9.22) Updates `org.jetbrains.kotlin:kotlin-reflect` from 1.9.10 to 1.9.22 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](JetBrains/kotlin@v1.9.10...v1.9.22) Updates `org.jetbrains.kotlin:kotlin-stdlib-common` from 1.9.10 to 1.9.22 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](JetBrains/kotlin@v1.9.10...v1.9.22) Updates `org.jetbrains.kotlin:kotlin-stdlib` from 1.9.10 to 1.9.22 - [Release notes](https://github.com/JetBrains/kotlin/releases) - [Changelog](https://github.com/JetBrains/kotlin/blob/master/ChangeLog.md) - [Commits](JetBrains/kotlin@v1.9.10...v1.9.22) Updates `org.jetbrains.kotlin:kotlin-maven-plugin` from 1.9.10 to 1.9.22 --- updated-dependencies: - dependency-name: org.jetbrains.kotlin:kotlin-stdlib-jdk8 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-reflect dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-stdlib-common dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-stdlib dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.jetbrains.kotlin:kotlin-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [deps]: Bump org.apache.maven.plugins:maven-resources-plugin (#2129) Bumps [org.apache.maven.plugins:maven-resources-plugin](https://github.com/apache/maven-resources-plugin) from 3.2.0 to 3.3.1. - [Release notes](https://github.com/apache/maven-resources-plugin/releases) - [Commits](apache/maven-resources-plugin@maven-resources-plugin-3.2.0...maven-resources-plugin-3.3.1) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-resources-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [deps]: Bump org.apache.maven.plugins:maven-source-plugin Bumps [org.apache.maven.plugins:maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.2.1 to 3.3.0. - [Commits](apache/maven-source-plugin@maven-source-plugin-3.2.1...maven-source-plugin-3.3.0) --- updated-dependencies: - dependency-name: org.apache.maven.plugins:maven-source-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tipsy <davidaase@hotmail.com> Co-authored-by: dzikoysk <dzikoysk@dzikoysk.net> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* [context] Prevent unintended usage of JDK 21 feature (closes #2117) - Import import kotlin.collections.removeFirst as removeFirstKt - Set <release> instead of <source> and <target> * [tests] Add more ApiBuilder tests * [distribution] Revert 64ccbe1 and use JDK11 for snapshots GH-2117 (#2123) * [deps]: Bump org.assertj:assertj-core from 3.25.0 to 3.25.3 Bumps [org.assertj:assertj-core](https://github.com/assertj/assertj) from 3.25.0 to 3.25.3. - [Release notes](https://github.com/assertj/assertj/releases) - [Commits](assertj/assertj@assertj-build-3.25.0...assertj-build-3.25.3) --- updated-dependencies: - dependency-name: org.assertj:assertj-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: tipsy <davidaase@hotmail.com> Co-authored-by: dzikoysk <dzikoysk@dzikoysk.net> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@Jerbell please try |
Thanks - tis working now |
Actual behavior (the bug)
When I set a cookie I get a
java.lang.NoSuchMethodError: 'java.lang.Object java.util.List.removeFirst()'
. I have confirmed with a minimal project.Expected behavior
Should be able to set a cookie.
To Reproduce
Click on the URL once the server has started.
Additional context
This only happens with Javalin 6.1.0. I'm not sure why this happens. It's not clear, because the code looks like it should all work. Could the Kotlin version have been changed accidentally on compile?
The text was updated successfully, but these errors were encountered: