okta-sdk-java icon indicating copy to clipboard operation
okta-sdk-java copied to clipboard

Scala Compilation Issue

Open parkerirving45 opened this issue 1 year ago • 5 comments

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

parkerirving45 avatar Oct 24 '24 22:10 parkerirving45

Could this be an IDE thing? which IDE are you using and can you refresh the dependencies and try reloading the project?

arvindkrishnakumar-okta avatar Nov 07 '24 00:11 arvindkrishnakumar-okta

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

parkerirving45 avatar Nov 07 '24 16:11 parkerirving45

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?

prachi-okta avatar Mar 18 '25 09:03 prachi-okta

The code snippet above is still relevant we were able to get around this by downgrading our sdk version

parkerirving45 avatar Mar 18 '25 15:03 parkerirving45

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

prachi-okta avatar Mar 28 '25 14:03 prachi-okta