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

Weird error in REPL: bad constant pool index: 0 #2509

Closed
pawelprazak opened this issue Nov 3, 2023 · 4 comments
Closed

Weird error in REPL: bad constant pool index: 0 #2509

pawelprazak opened this issue Nov 3, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@pawelprazak
Copy link

Version(s)
1.0.4

Describe the bug
Confusing and unexpected error in simplest REPL command.

To Reproduce

scala-cli
Welcome to Scala 3.3.0 (21, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> val s = ""
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

Expected behaviour
To not see two errors, or at least get actionable error messages.

@pawelprazak pawelprazak added the bug Something isn't working label Nov 3, 2023
@pawelprazak
Copy link
Author

pawelprazak commented Nov 3, 2023

I've updated scala-cli to 1.0.5 and it is fixed now:

scala-cli
Welcome to Scala 3.3.1 (21.0.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> val s = ""
val s: String = ""

scala>

@SethTisue
Copy link
Contributor

SethTisue commented Nov 4, 2023

looks like a JDK 21 thing

note that 1.0.5 defaults to 3.3.1 — I think on 1.0.4, scala-cli -S 3.3.1 would probably have worked for you

JDK 21 support landed in 3.3.1 with this PR scala/scala3#17536

scala/scala3#18618 will improve the error message you get, starting with 3.3.2, thanks to @bishabosha

@SethTisue
Copy link
Contributor

it's a bit unusual that there was a fairly long delay between Scala 3.3.1 coming out and Scala-CLI 1.0.5 coming out with 3.3.1 as the default. there is some discussion at #2394 about the prospect of avoiding such delays in the future

@pawelprazak
Copy link
Author

Thank you for the context! Keep up the good work :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants