After upgrading one of my projects to scala 2.13.4 I get the following error:
[error] java.lang.IllegalAccessError: Class 'scala.tools.nsc.transform.patmat.PatternExpansion$ExtractorAlignment' no access to: class 'scala.collection.immutable.LazyList$State'
[error] at java.base/java.lang.invoke.MethodHandle.sendResolveMethodHandle(MethodHandle.java:1237)
[error] at java.base/java.lang.invoke.MethodHandle.getCPMethodHandleAt(Native Method)
[error] at java.base/java.lang.invoke.MethodHandle.getAdditionalBsmArg(MethodHandle.java:935)
[error] at java.base/java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:1084)
[error] at scala.tools.nsc.transform.patmat.PatternExpansion$ExtractorAlignment.fromProductSelectors(PatternExpansion.scala:166)
(full stacktrace is here https://gist.github.com/froth/f4819191644ef6ced0be682ad55f8fa0 as it is quite a long one)
I did not change anything in the code base and I do not actively use LazyList in my project. To complicate things additionally: it works on my machine and fails in the pipeline (same java version, same sbt version(sbt 1.4.4 (AdoptOpenJDK Java 11.0.8)), I cleared all caches).
It is a multiproject build, the top level build.sbt is looking like https://gist.github.com/froth/516c4ea6f8bd98ed87e6a8cadaa117d1 and in the subproject it is the following: https://gist.github.com/froth/03af73900724f47154a0b2477edb47ca
As it is hard to reproduce and it is a internal project with further internal dependencies this is about all I can provide.
My question is: Does anybody know what causes it and what I can do. Or if somebody has ideas how to further debug this or what to try to get more information of what goes wrong.
This could eventually be fixed on our side by upgrading java from 11.0.8 to 11.0.9 (AdoptOpenJDK). Why and how that worked? No idea.