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

new with an anonymous class does not check that the constructor exists properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.2.0
    • tools
    • generic
    • generic



      Name: skT88420 Date: 06/04/99


      Run javac 1.2 on the following 2 files at once:

      ---- cut here for T.java ----
      package a;

      public class T {
          protected T() {}
      }
      ---- cut here for U.java ----
      class U {
          Object x = new a.T() { void foo(); };
      }
      ---- end U.java ----

      You will get no errors in spite of the fact that the T()
      constructor is not accessible in class U. If you remove the
      "{ void foo(); }" part, an error will be reported.

      Some files in JDK 1.2 (javax/swing/plag/basic/BasicOptionPaneUI.java
      and javax/swing/ImageIcon.java) should not typecheck correctly
      but pass javac 1.2 anyways because of this bug.
      (Review ID: 83958)
      ======================================================================

            wmaddoxsunw William Maddox (Inactive)
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: