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

error in constructor javax.swing.plaf.metal.MetalTabbedPaneUI.TabbedPaneLayout

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2
    • None
    • 1.4.2
    • client-libs
    • None

    Description

      We are in the process of fixing a compiler bug (4635044) that exposes a bug
      in the default constructor for
      javax.swing.plaf.metal.MetalTabbedPaneUI.TabbedPaneLayout.
      The relevant portions of all participating classes are

           1 // package javax.swing.plaf.basic;
           2
           3 class BasicTabbedPaneUI {
           4 public class TabbedPaneLayout /*...*/ {
           5 }
           6 }
           7
           8 // package javax.swing.plaf.metal;
           9
          10 class MetalTabbedPaneUI extends BasicTabbedPaneUI {
          11 public class TabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout {
          12 }
          13 }

      Because MetalTabbedPaneUI.TabbedPaneLayout has no constructors defined, the compiler
      is obligated to provide one as follows (JLS2 8.8.7):

      public TabbedPaneLayout() {
      super();
      }
      Since the superclass is an inner member class, by 8.8.5.1, (about a third
      of the way down page 195) it is a compile-time error if the superclass is
      not a member of a lexically enclosing class. The superclass,
      BasicTabbedPaneUI.TabbedPaneLayout is not a member of the lexically enclosing
      class, MetalTabbedPaneUI, because it is HIDDEN in that class
      by the declaration of the member MetalTabbedPaneUI.TabbedPaneLayout.
      Therefore the compiler is required to reject this code.

      The code can easily be corrected by adding the following after line 11:

              public TabbedPaneLayout() {
                  MetalTabbedPaneUI.this.super();
              }

      I am doing that in my own copy of the code so that I can proceed with
      my compiler bug fixes, but I'd like your blessing (please) on the
      correctness of this change before I put them back. If you approve then
      please assign this bug to me (gafter) and I will put this correction
      back with my compiler changes.

      Similar but analogous changes are requires in three other places,
      and should be similarly resolved. The four error messages follow:

      ../../../../src/share/classes/javax/swing/plaf/metal/MetalTabbedPaneUI.java:949: an enclosing instance that contains javax.swing.plaf.basic.BasicTabbedPaneUI.TabbedPaneLayout is required
          public class TabbedPaneLayout extends BasicTabbedPaneUI.TabbedPaneLayout {
                 ^
      ../../../../src/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java:95: an enclosing instance that contains javax.swing.plaf.basic.BasicComboPopup.InvocationKeyHandler is required
              protected class InvocationKeyHandler extends BasicComboPopup.InvocationKeyHandler {
                        ^
      ../../../../src/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java:245: an enclosing instance that contains javax.swing.plaf.basic.BasicComboBoxUI.ComboBoxLayoutManager is required
          public class ComboBoxLayoutManager extends BasicComboBoxUI.ComboBoxLayoutManager {
                 ^
      ../../../../src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java:86: an enclosing instance that contains javax.swing.plaf.basic.BasicComboPopup.InvocationKeyHandler is required
              protected class InvocationKeyHandler extends BasicComboPopup.InvocationKeyHandler {
                        ^

      Attachments

        Issue Links

          Activity

            People

              gafter Neal Gafter
              gafter Neal Gafter
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: