Skip to content

[java-interop] compiler error "Unable to access method in class with a super reference" when mixing java/scala inheritance #7936

@scabug

Description

@scabug

When a package scoped java class is in the inheritance hierarchy of a scala class, call to super method from scala results in compiler error "Unable to access method aMethod in class AJava with a super reference"

It is easily reproducible using this code:

// AJava.java
package test.java;

abstract class AJava {
    protected void aMethod() {
    }
}
// BJava.java
package test.java;

public class BJava extends AJava {
}
// CScala.scala
package test.scala

import test.java.BJava

class CScala extends BJava {

  protected override def aMethod() {
    super.aMethod()
  }

}

This is something which works in pure Java, and it also works for pure scala, but not for java/scala mixed code.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions