|
Quick Lists
|
|
Bug ID:
|
4083890
|
|
Votes
|
0
|
|
Synopsis
|
Empty statements are not marked as unreachable
|
|
Category
|
java:compiler
|
|
Reported Against
|
1.1.3
, 1.2fcs
, 1.2alpha1
|
|
Release Fixed
|
1.4(merlin)
|
|
State
|
10-Fix Delivered,
Verified,
bug
|
|
Priority:
|
4-Low
|
|
Related Bugs
|
4090852
,
4093121
,
4095173
,
4141355
,
4141373
,
4181162
,
4410964
,
4410966
,
4410987
,
4424381
|
|
Submit Date
|
03-OCT-1997
|
|
Description
|
Just a semicolon in a method body is a null statement. It has the full status
of a statement except that it is a noop.
Hence, the following method should not compile:
void f() {
return;;
}
The second semicolon is a different statement and is unreachable. There
should be an error reported that the second semicolon is unreachable.
|
|
Work Around
|
N/A
|
|
Evaluation
|
This is a bug. The ; is being picked out in the parser, but there
should be a special EmptyStatement node that undergoes reachability
like other statements.
xxxxx@xxxxx 1997-10-06
This bug exists in the jdk1.3 compiler.
xxxxx@xxxxx 1999-10-28
Well, I fixed it (the tree is called Skip), and discovered how often
people write things like
return 0;/* exit success */;
and
{
return f();
} catch (Whatever e) {
throw new Whatever2();
};
Note the extra semicolon in both cases. I fixed a number of problems
in JDK sources and reported a number of JCK test cases that are broken.
And I'll bet we get lots of problem reports from users once this bug
fix makes it public. My plan is to dup those bug reports to this one,
so people see WHY it isn't a compiler bug but rather was a bug in their
sources that the compiler simply wasn't catching before.
xxxxx@xxxxx 2001-02-05
|
|
Comments
|
Submitted On 23-NOV-2000
eblake
Here's another example of an unreachable ; that is not caught:
void f() {
try {
return;
} catch (Exception e) { return; }
/* unreachable -> */ ;
}
Submitted On 31-MAY-2001
tupari
This fix is all wrong. Instead of fixing the compiler you
should fix the specification to make unreachable null
statements legal.
Submitted On 21-JAN-2002
chymes1
I agree with tupari.
This is going to be a silly and annoying bug to find and
fix. It is diggicult to see the null statement, even when
you know what the error is ( which may programmers will
not) and when the lines are tiny and trivially simple.
Submitted On 22-JAN-2002
gafter
If the compiler disagrees with the spec, and the spec is
clear and
unambiguous and what was intended, then it is a compiler bug
and
must be fixed. If you would like to see the spec changed,
by all
means submit an RFE. If the spec is changed the compiler
will
then be changed to agree with the spec.
PLEASE NOTE: JDK6 is formerly known as Project Mustang
|
|
|
 |