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

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

    Details

    • Subcomponent:
    • Introduced In Version:
      7
    • Resolved In Build:
      b142
    • CPU:
      generic, x86
    • OS:
      generic, windows_xp
    • Verification:
      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

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: