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

Javac does not compile AWT class extended with inner class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • tools
    • None
    • beta
    • generic
    • generic
    • Verified

      When compiling the code at bottom, javac gave the following error:

      TextAreaTest.java:7: cannot resolve symbol
      symbol: class HeadlessException
                  public Dimension getPreferredSize() {
                                   ^
      1 error

      It seems that either HeadlessException is not treated as a RuntimeException,
      or it is not getting properly loaded when the superclass is being subclassed.
      Either way, the error message is incorrect, since method getPreferredSize()
      has nothing to do with HeadlessException.

      This is serious bug as some code that compiled with 1.3 and before will no
      longer compile in 1.4.

      import java.awt.Dimension;
      import java.awt.TextArea;

      public class TextAreaTest {
          public TextAreaTest() {
              TextArea userTextArea = new TextArea( "Java!" ) {
                  public Dimension getPreferredSize() {
                      return new Dimension( 300, 100 );
                  }
              };
          }

          public static void main( String argv[] ) {
              TextAreaTest demo = new TextAreaTest();
          }
      }

      shinsuke.fukuda@Eng 2000-07-31

            busersunw Btplusnull User (Inactive)
            sfukudasunw Shinsuke Fukuda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: