commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ot...@ivillage.com
Subject Re: byte b = 'a'; not allowed
Date Sat, 05 Jan 2002 03:53:28 GMT
Interesting, I never saw this, even though I used jikes (1.15).

However, I do get this warning below.  It is just a warning, but...


compile:
    [javac] Compiling 29 source files to /home/otis/cvs-repositories/jakarta/jakarta-commons/httpclient/target/classes
    [javac] 
    [javac] Issued 1 semantic warning compiling "/home/otis/cvs-repositories/jakarta/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/log/SimpleLog.java":
    [javac] 
    [javac]    103.         } catch(Throwable t) {
    [javac]                         <--------->
    [javac] *** Caution: This try block cannot throw a "checked exception" (JLS section 14.7)
that can be caught here. You may have intended to catch a RuntimeException instead of an Exception.
     [copy] Copying 3 files to /home/otis/cvs-repositories/jakarta/jakarta-commons/httpclient/target/classes

BUILD SUCCESSFUL


Otis


On Fri, 04 January 2002, Jeff Turner wrote:

> 
> There seems to be a bug in 'javac', which lets you implicitly typecast a char
> to a byte. Eg:
> 
> public class Test {
>   public static void main(String args[]) {
>     byte b = 'a';
> }
> 
> 'javac Test.java' compiles fine. That's from the Blackdown 1.3.0 JDK.
> 
> 'jikes Test.java' reports:
> 
> Found 1 semantic error compiling "Test.java":
> 
>      3.                 byte b = 'a';
>                                  <->
> *** Error: A byte value must be an integer value (note that a character literal is not
an integer value) in the range -128..127.
> 
> 
> Which makes perfect sense, since a char is 16 bits, and a byte is 8 bits. This
> is relevant to httpclient, which would not compile with jikes:
> 
>     [javac] Found 22 semantic errors compiling "/home/jeff/apache/jakarta/jakarta-commons/httpclient/src/java/org/apache/commons/httpclient/URIUtil.java":
>     [javac]
>     [javac]    703.             case '0':
>     [javac]                          <->
> ....
> 
> 
> I fixed httpclient with a typecast (email waiting in a moderator's queue
> presumably), but I thought I'd raise awareness of the issue here, and take the
> opportunity to do a bit of jikes advocacy ;)
> 
> 
> --Jeff
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>

_________________________________________________________________
iVillage.com: Solutions for Your Life 
Check out the most exciting women's community on the Web   
http://www.ivillage.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message