input line is too long

Tom Tromey tromey@redhat.com
Fri Jan 3 04:13:00 GMT 2003


>>>>> "Ranjit" == Ranjit Mathew <rmathew@hotmail.com> writes:

>> (short) 'Q'; //X

Ranjit> IMHO GCJ is doing the right thing. See:

Ranjit> 		char c = s;			// error: would require cast
Ranjit> because not all short values are char values, and neither are
Ranjit> all char values short values.

There is a special exception for narrowing primitive
conversions where the expression is a constant expression.
See 5.1.3.  This was changed here:

2002-08-26  Tom Tromey  <tromey@redhat.com>

	* parse.y (try_builtin_assignconv): Allow narrowing primitive
	conversion if RHS_TYPE is byte, short, or char.

Ranjit> However, "javac" in JDK1.4.1 doesn't complain about it, nor
Ranjit> does "jikes +P" (pedantic).

My experience is that jikes has the most correct front end.
If it doesn't complain, the code is most likely syntactically fine.

Tom



More information about the Java mailing list