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

Bogus compiler error when extending BaiscListUI.InputListener

XMLWordPrintable

      Although this problem was previously addressed by Bug #4090645, the analysis
      was incorrect, and the bug was closed without a fix.

      The documentation for BasicListUI states that a custom InputListener can be
      returned by implementing the following code:

      class MyListUI extends BasicListUI {
          protected InputListener createInputListener() {
              return new MyInputListener();
          }
          public class MyInputListener extends InputListener {
              public void mouseMoved(MouseEvent e) {
               // do some extra work when the mouse moves
               super.mouseMoved(e);
              }
          }
      }

      When this code is compiled, this message is generated:

      MyListUI.java:13: No constructor matching BasicListUI. InputListener(MyListUI) found in inner class BasicListUI. InputListener.
          public class MyInputListener extends BasicListUI.InputListener {

      In Bug #4090645 it was stated that the problem was a result of Bug #4087314, "protected inner classes are wrongly rejected in 'extends' clauses". Bug #4087314 was fixed in 1.2beta2. However, the same compiler message occurs
      when compiling with 1.2beta3. Compiling with 1.2beta2 results in a core dump.

      There are two workarounds for Bug #4087314. One is to put both classes in the same package, which is not practical when the inherited class is a Swing class.
      The other workaround is to make the inherited class public. However, when
      the code sample is compiled with a public BasicListUI.InputListener class,
      the same result occurs. It seems clear then that the source of this bug is
      not Bug #4087314, and that the problem needs to be re-investigated.

            sswingtrsunw Swingtraq Swingtraq (Inactive)
            nrodinsunw Nick Rodin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: