O
Oliver Wong
This is just as a heads up for other people using Eclipse who might run
into this bug. I got stuck on it while working on a project, and waste an
hour or so tracking down the cause.
My Eclipse version is 3.2.0 build ID is I20060217-1115.
Here's the test code:
<code>
public class TestCase {
public static void main(String[] args) {
{
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v,
w, x, y, z;
int aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap,
aq, ar, as, at, au, av, aw, ax, ay, az;
int ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp,
bq, br, bs, bt, bu, bv, bw, bx, by, bz;
}
{
Object fromToken = null;
Object toToken = null;
String fromString;
if (fromToken != null) {
fromString = "";
}
String toString;
if (toToken != null) {
toString = "";
}
System.out.println(fromString);
System.out.println(toString);
}
}
}
</code>
If you try to compile this with Sun's JavaC, it reports two compile
errors saying that fromString and toString might not have been initialized
when the println() occurs.
If you put this into Eclipse, Eclipse will compile it, and when you try
to run the class file produced by Eclipse, the JVM will throw an
java.lang.Verify error.
It looks like Eclipse "stops checking" when you declare too many
variables. These can be local variables, or fields of the class. Try
commenting out some of the useless variable declarations, and Eclipse will
correctly detect that the two strings are uninitialized.
I've already filed this with Eclipse's bug tracker:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=137298
- Oliver
into this bug. I got stuck on it while working on a project, and waste an
hour or so tracking down the cause.
My Eclipse version is 3.2.0 build ID is I20060217-1115.
Here's the test code:
<code>
public class TestCase {
public static void main(String[] args) {
{
int a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v,
w, x, y, z;
int aa, ab, ac, ad, ae, af, ag, ah, ai, aj, ak, al, am, an, ao, ap,
aq, ar, as, at, au, av, aw, ax, ay, az;
int ba, bb, bc, bd, be, bf, bg, bh, bi, bj, bk, bl, bm, bn, bo, bp,
bq, br, bs, bt, bu, bv, bw, bx, by, bz;
}
{
Object fromToken = null;
Object toToken = null;
String fromString;
if (fromToken != null) {
fromString = "";
}
String toString;
if (toToken != null) {
toString = "";
}
System.out.println(fromString);
System.out.println(toString);
}
}
}
</code>
If you try to compile this with Sun's JavaC, it reports two compile
errors saying that fromString and toString might not have been initialized
when the println() occurs.
If you put this into Eclipse, Eclipse will compile it, and when you try
to run the class file produced by Eclipse, the JVM will throw an
java.lang.Verify error.
It looks like Eclipse "stops checking" when you declare too many
variables. These can be local variables, or fields of the class. Try
commenting out some of the useless variable declarations, and Eclipse will
correctly detect that the two strings are uninitialized.
I've already filed this with Eclipse's bug tracker:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=137298
- Oliver