... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)

2007-01-12

Eclipse Java Compiler Bug

The Eclipse Java compiler issues an inappropriate warning in the following code:

    public int zot(Object obj) {
        if (obj instanceof String) return 1;
        if (obj == null) return 2; // inappropriate warning on this line
        return 3;
    }

It complains that obj cannot possibly be null -- even though it can.  Experimentation suggests that something about the instanceof operator confuses the compiler.

Blog Archive