duchess-rs / duchess

Silky smooth Java-Rust interop

Home Page:https://duchess-rs.github.io/duchess/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nested classes in java-package declaration

nikomatsakis opened this issue · comments

We need to support things like

package p;
class Foo { class Bar { } }

and then in Rust something like this

duchess::java_package! {
    package p;
    class Foo.Bar { * }
}

Not entirely clear how we should be mapping those... Foo_Bar? foo::Bar?

To support nested classes duchess should also need to parse types like scala.Option<A>.WithFilter, where the element in between the . is a class name with type parameters and not a package. The grammar used by the parser currently does not support type parameters before a dot.

The example comes from the return type of Scala's Option::withFilter method:

  public final scala.Option<A>.WithFilter withFilter(scala.Function1<A, java.lang.Object>);
    descriptor: (Lscala/Function1;)Lscala/Option$WithFilter;