cincheo / jsweet

A Java to JavaScript transpiler.
http://www.jsweet.org
Other
1.46k stars 160 forks source link

header missing for default method accessing superclass enum #530

Closed jmstark closed 5 years ago

jmstark commented 5 years ago

Hi! Assume I have the following classes and interfaces in Java (each class/interface in its own source file):

abstract class AA {
  public enum EA { EA1 };
}
class A implements IA {}
interface IA implements IB {}
interface IB {
  default void m() {
    System.out.println(EA.EA1);
  }
}

This roughly translates to this TS:

export class A implements IA {
  void m() {
    System.out.println(AA.EA.EA1);
  }
export interface IA extends IB {}
export interface IB {
  m(): void;
}
export abstract class AA {}
export namespace AA {
  export enum EA {
      EA1
  }
}

The important thing is that the default method m() gets transpiled into A and EA.A1 is accessed via AA.EA.A1, BUT A.ts does not include the neccessary header and thus the compiler complains that it does not know AA. Any idea on why that is?

Thanks in advance for any help and for this interesting peace of software!