This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
excessive cast requirements
- From: "Erik Poupaert" <erik dot poupaert at chello dot be>
- To: <java at gcc dot gnu dot org>
- Date: Mon, 10 Feb 2003 12:47:58 +0100
- Subject: excessive cast requirements
While trying to build the mysql Connector/J jdbc driver natively with GCJ,
I've run into the same bug as when building SWT natively. We've discussed it
then, but I'm not sure as to whether it will be fixed in 3.3. In the
PreparedStatement.java source, I was forced to add excessive casts:
byte b = x[i];
switch (b) {
src/com/mysql/jdbc/PreparedStatement.java:399: case
(byte)'\n': /* Must be escaped for logs */
src/com/mysql/jdbc/PreparedStatement.java:405: case
(byte)'\r':
src/com/mysql/jdbc/PreparedStatement.java:411: case
(byte)'\\':
src/com/mysql/jdbc/PreparedStatement.java:417: case
(byte)'\'':
src/com/mysql/jdbc/PreparedStatement.java:423: case
(byte)'"': /* Better safe than sorry */
src/com/mysql/jdbc/PreparedStatement.java:429: case
(byte)'\032': /* This gives problems on Win32 */
}
We've discussed this on the mailing list, and we came to the conclusion that
the Java specs do not require such casts (adding the byte cast). Has the
problem of excessive cast requirements been addressed for GCJ 3.3? Or is it
hanging somewhere in between fixing?
In my impression, these excessive cast requirements prevent quite a few
source trees from compiling out of the box with GCJ.