Skip to content

Issue finding Java classes defined in interfaces when compiling Scala code referencing them  #10859

Closed
@pmeheut

Description

@pmeheut

In our Java code, we define Java classes as default implementation in interfaces such as:
interface Foo {
class DefaultFoo implements Foo {
}
}
See the attached file for a simple example: unzip it and try to compile it with:
scalac Foo.java Bar.java Quux.scala

You should get an error:
[error] /Users/pascal/foo/src/main/java/Bar.java:2:34: not found: type DefaultFoo [error] public class DefaultBar extends DefaultFoo implements Bar {

But javac (any version but we use 1.8 131) compiles this Java code.

We tried with Scala 2.11 (many versions) and Scala 2.12.5.

An obvious workaround is to change the java code to public class DefaultBar extends Foo.DefaultFoo
But as we have a huge code base written this way, this is inconvenient.
We also have the same bug inside methods where scala does not see enum defined as subclasses of an interface another Java class extends.

Foo.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions