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

ClassfileParser: allow missing param names (for JDK 21) #17536

Merged
merged 1 commit into from
May 22, 2023

Conversation

SethTisue
Copy link
Member

@SethTisue SethTisue commented May 19, 2023

this is a forward port of scala/scala#10397 (fixing scala/bug#12783, from which Scala 3 also suffers) — the same fix we'll be shipping in 2.12.18 and 2.13.11

I haven't included a unit test, because

  • a similar change has already been well validated in a Scala 2 context
  • without this change, the compiler can't compile anything at all on JDK 21
  • we need the reference compiler to include this change before we can bootstrap on JDK 21 anyway

but I did manually test it locally, by bootstrapping on JDK 11, publishing the resulting compiler locally, and then launching the REPL on JDK 21 and evaluating 2 + 2

on 3.3.0-RC6, that fails with:

error while loading AccessFlag,
class file /modules/java.base/java/lang/reflect/AccessFlag.class is broken, reading aborted with class java.lang.RuntimeException
bad constant pool index: 0 at pos: 5189
error while loading ElementType,
class file /modules/java.base/java/lang/annotation/ElementType.class is broken, reading aborted with class java.lang.RuntimeException
bad constant pool index: 0 at pos: 1220
2 errors found

whereas with this change, it succeeds.

this is a forward port of scala/scala#10397 (fixing scala/bug#12783,
from which Scala 3 also suffers)
@He-Pin
Copy link

He-Pin commented May 22, 2023

This will be included in the Scala 3.3.0-RC7?

@SethTisue
Copy link
Member Author

This will be included in the Scala 3.3.0-RC7?

Nah, it can wait for 3.3.1.

@SethTisue SethTisue requested a review from smarter May 22, 2023 06:58
@smarter smarter merged commit c205a89 into scala:main May 22, 2023
@SethTisue SethTisue deleted the fix-classfile-parsing-on-jdk-21 branch May 22, 2023 17:55
SethTisue added a commit to SethTisue/scala that referenced this pull request May 25, 2023
this should work on JDK 21 now that scala/scala3#17536
has been merged
@SethTisue
Copy link
Member Author

This will be included in the Scala 3.3.0-RC7?

(It's in 3.3.1-RC1, which is now on Maven Central.)

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.

3 participants