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 accessing/invoking method reference to protected method in superclass #641

Closed
1 of 3 tasks
guillerodriguez opened this issue Apr 7, 2022 · 1 comment

Comments

@guillerodriguez
Copy link

Issue details

I am getting an IllegalAccessError when trying to access/invoke a method reference to a protected method in a superclass. The issue looks similar to this:

I thought it was a Javac issue however I tried to build a console application to confirm this and the compiled code runs fine using a standard JRE, but fails when run using robovm. So I suspect a robovm compiler issue.

Reproduction steps/code

package testref;

import testref.b.B;

public class Main
{
    public static void main(String[] args)
    {
        new B().run();
    }
}
package testref.a;

public class A
{
    protected void exec() {
        System.out.print("Exec");
    }
}
package testref.b;

import testref.a.A;
import testref.c.C;

public class B extends A
{
    private final C c = new C();

    public void run() {
        c.run(this::exec);
    }
}
package testref.c;

public class C
{
    public interface Command
    {
        void run();
    }

    public void run(Command command)
    {
        command.run();
    }
}

Configuration

Build Tools:

  • IDEA plugin
  • Eclipse plugin
  • Gradle plugin

Versions:

  • Robovm-2.3.15-SNAPSHOT
  • javac 1.8.0_202
  • java version "1.8.0_202"

Build Targets:

Seen on real iOS devices, but reproducible on console sample app (see above).


Stacktrace

java.lang.IllegalAccessError: Attempt to access method testref.a.A.exec()V from class testref.b.B$$Lambda$1
at testref.b.B$$Lambda$1.run(Unknown Source)
at testref.c.C.run(C.java:12)
at testref.b.B.run(B.java:11)
at testref.Main.main(Main.java:9)
@dkimitsa
Copy link
Contributor

fix proposed in #646

Tom-Ski added a commit that referenced this issue Apr 19, 2022
…o-protected

* fixed: #641 java.lang.IllegalAccessError: Attempt to access protected method from Lambda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants