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

Receive an internal error from javac when compiling a class

XMLWordPrintable

    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      java version "1.5.0_09"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_09-b01)
      Java HotSpot(TM) Client VM (build 1.5.0_09-b01, mixed mode, sharing)


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

      A DESCRIPTION OF THE PROBLEM :
      I tried something silly with generics and arrays that gave me a compiler internal error.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just simply compile the following class with no options

      javac name\slacroix\C3.java

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      get a compilation error about some type mismatch
      ACTUAL -
      name\slacroix\C3.java:9: internal error; cannot instantiate <T>binarySearch(T[],T,java.util.Comparator<? super T>) at java.ut
      il.Arrays to (long[][],int,java.util.Comparator<long[]>)
                  int indexFound = Arrays.binarySearch(arrayMap, 1, comparator);
                                                      ^
      1 error


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      name\slacroix\C3.java:9: internal error; cannot instantiate <T>binarySearch(T[],T,java.util.Comparator<? super T>) at java.ut
      il.Arrays to (long[][],int,java.util.Comparator<long[]>)
                  int indexFound = Arrays.binarySearch(arrayMap, 1, comparator);
                                                      ^
      1 error


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package name.slacroix;

      import java.util.Arrays;
      import java.util.Comparator;

      public class C3 {
          static protected long[][] arrayMap = new long[100][2];

          public static void main(String[] args) {
                  int indexFound = Arrays.binarySearch(arrayMap, 1, comparator);
          }
          static protected Comparator<long[]> comparator = new Comparator<long[]>(){
                  public int compare(long[] a, long[] b) {
                      return 1;
                  }
              };
      }

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

            Unassigned Unassigned
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: