Static import declaration imports too much

Issue #287 resolved
Jesper Öqvist created an issue

ExtendJ 8.1.0-47-gdeb1b1c Java SE 8

The following test should fail to compile:

Test.java:

// .result: COMPILE_PASS
import static pkg.A.newB;

public class Test {
  B fail = newB(); // Error: B not imported!
}

A.java:

package pkg;

public class A {
  public static class B extends A {
  }

  public static B newB() {
    return new B();
  }
}

Expected result: should fail to compile:

    [junit] Compilation failed when expected to pass:
    [junit] tests/pkg/static_import_05f/Test.java:5: error: cannot find symbol
    [junit]   B fail = newB(); // Error: B not imported!
    [junit]   ^
    [junit]   symbol:   class B
    [junit]   location: class Test
    [junit] 1 error

Actual result: ExtendJ compiles the code without errors.

Comments (2)

  1. Log in to comment