-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
None
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
As indicated in the Java Specification Language (JLS, Chapter 10.4 Array Access):
"Arrays must be indexed by int values; short, byte, or char values may also be used as index values because they are subjected to unary numeric promotion (§5.6.1) and become int values.
An attempt to access an array component with a long index value results in a compile-time error."
But, I wish that Java supports large array index, then I can use java to build my HPC system to process over 2^31-1 data size, not only in C or C++, like the example shown in the source code section.
---------- BEGIN SOURCE ----------
import java.io.IOException;
public class Experiment {
public static void main(String[] args) throws IOException {
long l=4*1024*1024*1024L;
int[]i=new int[l];
}
}
---------- END SOURCE ----------
As indicated in the Java Specification Language (JLS, Chapter 10.4 Array Access):
"Arrays must be indexed by int values; short, byte, or char values may also be used as index values because they are subjected to unary numeric promotion (§5.6.1) and become int values.
An attempt to access an array component with a long index value results in a compile-time error."
But, I wish that Java supports large array index, then I can use java to build my HPC system to process over 2^31-1 data size, not only in C or C++, like the example shown in the source code section.
---------- BEGIN SOURCE ----------
import java.io.IOException;
public class Experiment {
public static void main(String[] args) throws IOException {
long l=4*1024*1024*1024L;
int[]i=new int[l];
}
}
---------- END SOURCE ----------
- relates to
-
JDK-8021941 Array indexing with long
-
- Closed
-