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

IllegalAccessError with package protected java class #10249

Open
scabug opened this issue Mar 23, 2017 · 2 comments
Open

IllegalAccessError with package protected java class #10249

scabug opened this issue Mar 23, 2017 · 2 comments
Assignees
Labels

Comments

@scabug
Copy link

scabug commented Mar 23, 2017

A.java

package a;
abstract class A {
    public final void m() { System.out.println("hi"); }
}

Test.scala

package a {
  // A is a class, so W does not conform to A in bytecode. an access (w: W).m() requires a cast to A.
  // If `A` is not accessible, there's no solution, need to issue an error. Currently crashes.
  trait W extends A
  class C extends W
}

object Test {
  def main(args: Array[String]): Unit = {
    val w: a.W = new a.C
    w.m()
  }
}

Crashes

java.lang.IllegalAccessError: tried to access class a.A from class Test$
@scabug
Copy link
Author

scabug commented Mar 23, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10249?orig=1
Reporter: @lrytz
Affected Versions: 2.12.1
See #4283

@scabug
Copy link
Author

scabug commented Mar 23, 2017

@lrytz said:
Related to #4283, it's an example that cannot be solved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants