Name: yyT116575 Date: 05/29/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
I have some code that I used to compile without any problem with JDK 1.3.0.
When i installed the Beta version of 1.4 I could no more comile my code....
so that I tried to find what was the problem ...
finally I extracted this piece of code as being the one causing the error:
<code>
public class BugToto {
/**
*
*
*
*
*/
public String getString(){
return "BugToto";;
}
public String getBidon(String a[]){
for (int i=0;i<a.length;++i) if (a[i]!=null) return a[i];
return null;
}
}
</code>
when compiling i have the following error message :
<CODE>
BugToto.java:13: unreachable statement
for (int i=0;i<a.length;++i) if (a[i]!=null) return a[i];
^
1 error
</CODE>
In fact, the problem is the double ';' (in <code>return "BugToto";;</code>) but
the error reporting is incorrect!
Indeed, the compiler considers the second ';' as a statement coming after a
return statement... so it is <B><I>unreachable </I></B>....
but the same code goes well in jdk 1.3.
further more, the error reporting calculates in a wrong way the position of the
error because of the comments (which is a BUG)...
hope i was helpful !!
(Review ID: 125290)
======================================================================
- duplicates
-
JDK-4463373 JavaDoc comments throw off javac line numbers
- Closed