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

Compiler generate error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 7
    • tools
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b141)
      Java HotSpot(TM) Client VM (build 21.0-b11, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      Good code causes a compiler error.
      This is a regression. Not happened in 1.7.0-ea-b139
      The error code is:

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

      REGRESSION. Last worked in version 7

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the code below.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Non compiler errors.
      ACTUAL -
      C:\data\LearnJAVA2\JDK7Bugs\src\ArraylengthError.java
          Error:Error:line (5)error: length in Array is defined in an inaccessible class or interface

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      C:\data\LearnJAVA2\JDK7Bugs\src\ArraylengthError.java
          Error:Error:line (5)error: length in Array is defined in an inaccessible class or interface

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class ArraylengthError {

          protected static int arraylength(Class<? extends Enum<?>> etype) {

              int n = etype.getEnumConstants().length;

              return n;
          }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      We can change all such pattern in code, but it is quite difficult.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: