Skip to content

Instantly share code, notes, and snippets.

@xuwei-k
Created September 11, 2024 10:13
Show Gist options
  • Save xuwei-k/853319c7c9daa8b38888aca086daa34a to your computer and use it in GitHub Desktop.
Save xuwei-k/853319c7c9daa8b38888aca086daa34a to your computer and use it in GitHub Desktop.
package x;
class A {
public int a() { return 2; }
}
public class B extends A{}
scalaVersion := "3.5.1-RC2"
run / fork := true
[info] running (fork) y.Main
[error] Exception in thread "main" java.lang.IllegalAccessError: failed to access class x.A from class y.C (x.A and y.C are in unnamed module of loader 'app')
[error] at y.C.c(Main.scala:4)
[error] at y.Main$.main(Main.scala:9)
[error] at y.Main.main(Main.scala)
[error] Nonzero exit code returned from runner: 1
[error] (Compile / run) Nonzero exit code returned from runner: 1
package y;
class C extends x.B {
def c: Int = super.a
}
object Main {
def main(args: Array[String]): Unit = {
println((new C).c)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment