JDK-4700016 : error in constructor javax.swing.plaf.metal.MetalTabbedPaneUI.TabbedPaneLayout
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 1.4.2
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2002-06-10
  • Updated: 2002-06-12
  • Resolved: 2002-06-12
Related Reports
Duplicate :  
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 {
                  ^

Comments
PUBLIC COMMENTS ...
10-06-2004

EVALUATION I'll take care of this. Because I am fixing it with my changes for 4635044, I am marking this bug as a dup of that. ###@###.### 2002-06-11
11-06-2002