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

Compilation error: "length in Array is defined in an inaccessible class or interface"

    XMLWordPrintable

Details

    • 7
    • b142
    • generic, x86
    • generic, windows_xp
    • Verified

    Description

      Using javac in jdk7_b140.

      Compilation error

      NumberOfFocusListeners.java:14: error: length in Array is defined in an inaccessible class or interface
              return button.getListeners(listener.getClass()).length;
                                                             ^
      1 error,


      when trying to compile the following mini-test:

      /********************************************************************/

      import java.awt.Button;
      import java.awt.event.FocusAdapter;
      import java.awt.event.FocusListener;

      public class NumberOfFocusListeners {

          public static void main(String[] args) {
              System.out.println(numberOfFocusListeners());
          }

          private static int numberOfFocusListeners() {
              FocusListener listener = new FocusAdapter(){};
              Button button = new Button();
              return button.getListeners(listener.getClass()).length;
          }
      }

      /********************************************************************/

      Javac in jdk7_b140 (win x86, linux x86) cannot compile this code. Javac in jdk7_b139, jdk6_u25 and jdk6_u24 compiles it without problems. So, it seems like regression bug.
      The following JCK test
      api/javax_swing/plaf/metal/MetalComboBoxUI/index.html#public

      won't be compiled with JDK7 b140 javac (with the default source/target options)



      tests/api/javax_swing/plaf/metal/MetalComboBoxUI/publicTests.java:145: error: length in Array is defined in an inaccessible class or interface
                      c.getFocusListener().getClass()).length;
                                                      ^
      tests/api/javax_swing/plaf/metal/MetalComboBoxUI/publicTests.java:151: error: length in Array is defined in an inaccessible class or interface
                      c.getFocusListener().getClass()).length)) {
                                                      ^

      Attachments

        Issue Links

          Activity

            People

              mcimadamore Maurizio Cimadamore
              alfedoro Alexey Fedorov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: