[PR #1080] [MERGED] chore: use javac -release and kotlinc -Xjdk-release so the generated bytecode adheres to the APIs for the target Java release #878

Closed
opened 2025-12-30 01:27:27 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/apple/pkl/pull/1080
Author: @vlsi
Created: 5/28/2025
Status: Merged
Merged: 5/28/2025
Merged by: @bioball

Base: mainHead: java_target


📝 Commits (1)

  • 6e6d7f1 Use javac -release and kotlinc -Xjdk-release

📊 Changes

4 files changed (+15 additions, -18 deletions)

View changed files

📝 buildSrc/build.gradle.kts (+6 -4)
📝 buildSrc/src/main/kotlin/pklAllProjects.gradle.kts (+4 -5)
📝 buildSrc/src/main/kotlin/pklJavaLibrary.gradle.kts (+1 -8)
📝 buildSrc/src/main/kotlin/pklKotlinLibrary.gradle.kts (+4 -1)

📄 Description

Previously, only sourceCompatibility and targetCompatibility were used, and they might cause issues like NoSuchMethodError when a newer javac compiles with -target older_release.

Note: it is good to use a new an up to date javac to avoid issues in the compiler itself, so having a proper -release .. configuration is vital.

See https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/apple/pkl/pull/1080 **Author:** [@vlsi](https://github.com/vlsi) **Created:** 5/28/2025 **Status:** ✅ Merged **Merged:** 5/28/2025 **Merged by:** [@bioball](https://github.com/bioball) **Base:** `main` ← **Head:** `java_target` --- ### 📝 Commits (1) - [`6e6d7f1`](https://github.com/apple/pkl/commit/6e6d7f1097d4adf9ee32d15469faa73bdbcd3cf8) Use javac -release and kotlinc -Xjdk-release ### 📊 Changes **4 files changed** (+15 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `buildSrc/build.gradle.kts` (+6 -4) 📝 `buildSrc/src/main/kotlin/pklAllProjects.gradle.kts` (+4 -5) 📝 `buildSrc/src/main/kotlin/pklJavaLibrary.gradle.kts` (+1 -8) 📝 `buildSrc/src/main/kotlin/pklKotlinLibrary.gradle.kts` (+4 -1) </details> ### 📄 Description Previously, only sourceCompatibility and targetCompatibility were used, and they might cause issues like NoSuchMethodError when a newer javac compiles with -target older_release. Note: it is good to use a new an up to date javac to avoid issues in the compiler itself, so having a proper `-release ..` configuration is vital. See https://www.morling.dev/blog/bytebuffer-and-the-dreaded-nosuchmethoderror/ --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-30 01:27:27 +01:00
adam closed this issue 2025-12-30 01:27:27 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pkl#878