Name: ###@###.### Date: 08/16/96
It will be better if compiler will provide more accurate error
message and indication of the error for the following illegal
array creation expression:
long[] ia = new long[5L]
Test:
-----
package javasoft.sqe.tests.lang.lex000.lex00001;
import java.io.PrintStream;
class lex00001 {
public static void main (String args []) {
System.exit(run(args,System.out));
}
public static int run(String args[],PrintStream out) {
long[] ia = new long[5L];
ia[5L] = 5L;
return 0;
}}
Now compiler issues the following error messages:
----------ref:compile.java(7/393)----------
/net/novo33/export/ld32/spn/java_tests/tests/lang/LEX/lex029/lex02901/lex02901.java:13: Incompatible type for new. Explicit cast needed to convert long to int.
long[] ia = new long[5L];
^
/net/novo33/export/ld32/spn/java_tests/tests/lang/LEX/lex029/lex02901/lex02901.java:14: Incompatible type for []. Explicit cast needed to convert long to int.
ia[5L] = 5L;
^
2 errors
Second error message is good, but first message and indication of the first error
are not accurate. It may be difficult for user to understand this diagnostics.
======================================================================
- duplicates
-
JDK-4278961 # error reporting and recovery issues in the new compiler
-
- Closed
-