input line is too long

Ranjit Mathew rmathew@hotmail.com
Thu Jan 2 08:49:00 GMT 2003


Erik Poupaert wrote:
> (3) This is the (short) to (char) cast stuff:
>> src/org/eclipse/swt/widgets/Control.java:46://X static final short []
> ACCENTS = new short [] {'~', '`','\'', '^', '"'};
>> I had to change it into: "static final short [] ACCENTS = new short []
> {(short)'~', (short)'`', (short)'\'',(short) '^',(short) '"'};"
>> Same for: src/org/eclipse/swt/widgets/Decorations.java:320: accel.key =
> (short) 'Q'; //X

IMHO GCJ is doing the right thing. See:
http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#184206
And I quote from there:
----------------------------------- 8< -----------------------------------
The following test, however, produces compile-time errors:
class Test {
	public static void main(String[] args) {
		short s = 123;
		char c = s;			// error: would require cast
		s = c;				// error: would require cast
	}
}
because not all short values are char values, and neither are all char values short values.
----------------------------------- 8< -----------------------------------
However, "javac" in JDK1.4.1 doesn't complain about it, nor
does "jikes +P" (pedantic).
Sincerely Yours,
Ranjit.
-- 
Ranjit Mathew Email: rmathew AT hotmail DOT com
Bangalore, INDIA. Web: http://ranjitmathew.tripod.com/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /