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

defining interface method static causes misleading error

XMLWordPrintable

    • 1.0fcs
    • sparc
    • generic
    • Not verified

      Consider the following code:

      interface Foo {
          void NonStatic();
      }
       
      final class ack implements Foo {
          static void NonStatic() {
          }
      }


      When I compile this I get:

      static.java:6: Static methods can't be overridden. Method void NonStatic() is static in interface Foo.
          static void NonStatic() {
                      ^
      1 error

      This error message is a bit confusing because NonStatic in Foo is not static.

      DREL 10/28/95

            fyellinsunw Frank Yellin (Inactive)
            dlong Dean Long
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: