-
Bug
-
Resolution: Duplicate
-
P4
-
5.0
-
sparc
-
solaris_9
Name: rmT116609 Date: 07/01/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
SunOS mary 5.9 Generic_112233-12 sun4u sparc SUNW,Sun-Blade-100
A DESCRIPTION OF THE PROBLEM :
The method <T> int binarySearch(T[] a, T key, Comparator<? super T> c) in java.util.Arrays doesn't compile if T is an array of a primitive type (int[], long[], etc.)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the program below
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should compile.
ACTUAL -
Foo.java:10: cannot find symbol
symbol : method binarySearch(int[][],int[],java.util.Comparator<int[]>)
location: class java.util.Arrays
Arrays.binarySearch(arr, elem, c);
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
class Foo {
void foo1() {
Comparator<int[]> c = new Comparator<int[]>() {
public int compare(int[] c1, int[] c2) { return 0; }
};
int[][] arr = { { 1 } };
int[] elem = arr[0];
Arrays.sort(arr, c);
Arrays.binarySearch(arr, elem, c);
}
void foo2() {
Comparator<Integer[]> c = new Comparator<Integer[]>() {
public int compare(Integer[] c1, Integer[] c2) { return 0; }
};
Integer[][] arr = { { 1 } };
Integer[] elem = arr[0];
Arrays.sort(arr, c);
Arrays.binarySearch(arr, elem, c);
}
}
---------- END SOURCE ----------
(Incident Review ID: 282110)
======================================================================
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
SunOS mary 5.9 Generic_112233-12 sun4u sparc SUNW,Sun-Blade-100
A DESCRIPTION OF THE PROBLEM :
The method <T> int binarySearch(T[] a, T key, Comparator<? super T> c) in java.util.Arrays doesn't compile if T is an array of a primitive type (int[], long[], etc.)
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run the program below
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The program should compile.
ACTUAL -
Foo.java:10: cannot find symbol
symbol : method binarySearch(int[][],int[],java.util.Comparator<int[]>)
location: class java.util.Arrays
Arrays.binarySearch(arr, elem, c);
^
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
class Foo {
void foo1() {
Comparator<int[]> c = new Comparator<int[]>() {
public int compare(int[] c1, int[] c2) { return 0; }
};
int[][] arr = { { 1 } };
int[] elem = arr[0];
Arrays.sort(arr, c);
Arrays.binarySearch(arr, elem, c);
}
void foo2() {
Comparator<Integer[]> c = new Comparator<Integer[]>() {
public int compare(Integer[] c1, Integer[] c2) { return 0; }
};
Integer[][] arr = { { 1 } };
Integer[] elem = arr[0];
Arrays.sort(arr, c);
Arrays.binarySearch(arr, elem, c);
}
}
---------- END SOURCE ----------
(Incident Review ID: 282110)
======================================================================
- duplicates
-
JDK-4941882 incorrect inference for result of lub(int[], float[])
-
- Closed
-
- relates to
-
JDK-6332204 com.sun.tools.javac.code.Types.lub() throws NPE
-
- Closed
-
-
JDK-6222762 Primitive arrays and varargs inference leads to crash in TreeMaker.Type(TreeMaker.java:531)
-
- Closed
-