Skip to content

Conversation

SethTisue
Copy link
Member

@SethTisue SethTisue commented Jan 25, 2024

This makes certain Java libraries compiled using Java 21 usable from Scala — libraries that use switch in a certain way.

The fix is to our classfile reader, to recognize CONSTANT_Dynamic when it appears in the constant pool.

Fixes scala/bug#12936

Implementation notes

Previous PR in this vein, for comparison: #8289

I verified that partest test/files/pos/t12396 was failing locally on JDK 21 but now passes.

PR validation runs on Java 8, so it will not run the test, but it will run at https://github.com/scala/scala/actions after the PR is merged; our GitHub Actions config has java: [8, 11, 17, 21]

@SethTisue SethTisue added the prio:blocker release blocker (used only by core team, only near release time) label Jan 25, 2024
@SethTisue SethTisue added this to the 2.12.19 milestone Jan 25, 2024
@SethTisue SethTisue self-assigned this Jan 25, 2024
@SethTisue SethTisue changed the title Classfile reader: allow CONSTANT_Dynamic in constant pool Classfile reader: allow CONSTANT_Dynamic in constant pool Jan 25, 2024
@SethTisue SethTisue requested a review from lrytz January 25, 2024 23:42
@som-snytt
Copy link
Contributor

I thought the guy who does those forward merges to 2.13 would get around to it eventually.

Copy link
Member

@lrytz lrytz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍
Added a test that will notify us on the next asm upgrade that introduces a new constant.

@lrytz lrytz enabled auto-merge January 26, 2024 08:03
@lrytz lrytz merged commit afbad90 into scala:2.12.x Jan 26, 2024
@SethTisue SethTisue deleted the issue-12936 branch January 26, 2024 13:00
SethTisue added a commit to scala/scala3 that referenced this pull request Jan 30, 2024
forward-port of scala/scala#10675 and scala/scala#8595
references scala/bug#12396 and scala/bug#11635
fixes #19527 ("bad constant pool tag 17")
also fixes unreported potential "bad constant pool tag 19" and "bad constant pool tag 20" errors
@SethTisue SethTisue added release-notes worth highlighting in next release notes and removed prio:blocker release blocker (used only by core team, only near release time) labels Feb 6, 2024
@SethTisue SethTisue changed the title Classfile reader: allow CONSTANT_Dynamic in constant pool Support certain Java libraries compiled on JDK 21 Feb 6, 2024
tgodzik pushed a commit to tgodzik/scala3 that referenced this pull request Apr 30, 2025
forward-port of scala/scala#10675 and scala/scala#8595
references scala/bug#12396 and scala/bug#11635
fixes scala#19527 ("bad constant pool tag 17")
also fixes unreported potential "bad constant pool tag 19" and
"bad constant pool tag 20" errors
tgodzik pushed a commit to scala/scala3 that referenced this pull request May 1, 2025
forward-port of scala/scala#10675 and scala/scala#8595
references scala/bug#12396 and scala/bug#11635
fixes #19527 ("bad constant pool tag 17")
also fixes unreported potential "bad constant pool tag 19" and
"bad constant pool tag 20" errors
tgodzik pushed a commit to scala/scala3-lts that referenced this pull request May 5, 2025
forward-port of scala/scala#10675 and scala/scala#8595
references scala/bug#12396 and scala/bug#11635
fixes scala#19527 ("bad constant pool tag 17")
also fixes unreported potential "bad constant pool tag 19" and
"bad constant pool tag 20" errors
tgodzik added a commit to scala/scala3-lts that referenced this pull request May 5, 2025
forward-port of scala/scala#10675 and scala/scala#8595
references scala/bug#12396 and scala/bug#11635
fixes scala#19527 ("bad constant pool tag 17")
also fixes unreported potential "bad constant pool tag 19" and
"bad constant pool tag 20" errors

[Cherry-picked 26852de][modified]
gabrielrussoc pushed a commit to databricks/scala that referenced this pull request Aug 4, 2025
Classfile reader: allow `CONSTANT_Dynamic` in constant pool
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-notes worth highlighting in next release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants