Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8034924

Incorrect inheritance of inaccessible static method

XMLWordPrintable

    • b09
    • Verified

        This code:

        === base/BaseImpl.java ===
        package base;

        public class BaseImpl {
          static void foo(Object o) {}
        }
        ===

        === Test.java ===
        class Impl extends base.BaseImpl {
          public void foo(Object o) {}
        }

        class MyImpl extends Impl {
          public void m(Object o) {
            foo(o);
          }
        }
        ===

        after compilation:
        javac base/BaseImpl.java Test.java

        fails with:
        Test.java:7: error: no enclosing instance of type Impl is in scope
            foo(o);
            ^

        reported by Liam Miller-Cushon at compiler-dev: http://mail.openjdk.java.net/pipermail/compiler-dev/2014-February/008511.html

              vromero Vicente Arturo Romero Zaldivar
              abuckley Alex Buckley
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: