Scala Compilation Issue
Describe the bug?
On any version greater than 13.0.2 I get this compilation issue
[error] bad constant pool index: 0 at pos: 1942
[error] while compiling: /Staff.scala
[error] during phase: globalPhase=typer, enteringPhase=parser
[error] library version: version 2.12.16
[error] compiler version: version 2.12.16
[error] == Source file context for tree position ==
[error]
[error] 28 case _ => EmploymentType.Contigent;
[error] 29 },
[error] 30 managerEmail = user.getProfile.getManager,
[error] 31 employmentStatus = user.getStatus.toString match {
[error] 32 case "ACTIVE" => EmploymentStatus.Active;
[error] 33 case "DEPROVISIONED" => EmploymentStatus.Deprovisioned;
[error] 34 case "PROVISIONED" => EmploymentStatus.Provisioned;
I am on scala version 2.12 and using Java 11.0.18. In the docs it mentions you need to use Java 11+ which I am using. The compilation issue goes away if I remove any calls to UserStatus or getStatus when on version 19.0.2. It also goes away when I run version 13.0.2.
What is expected to happen?
Should compile successfully
What is the actual behavior?
Compilation fails with error above
Reproduction Steps?
Run a scala sbt project on scala 2.12 and java version 11 and then try and access User.getStatus
Additional Information?
No response
Java Version
11.0.18
SDK Version
19.0.2
OS version
No response
Could this be an IDE thing? which IDE are you using and can you refresh the dependencies and try reloading the project?
Could this be an IDE thing? which IDE are you using and can you refresh the dependencies and try reloading the project?
This is happening when running sbt compile from the command line not within an IDE
Hi @parkerirving45, I will be working on this. Could you confirm if you are still facing an issue? If yes, could you also provide the code snippets which are being problematic?
The code snippet above is still relevant we were able to get around this by downgrading our sdk version
Hi @parkerirving45! If you're currently using Scala 2.12 and encountering compatibility issues with Java compilation, upgrading to Scala 2.13 is advisable. Scala 2.13 offers improved support for newer Java versions, including Java 11, enhancing interoperability and performance.
You can refer this doc here for more information: https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html#jdk-11-compatibility-notes