Hello Java Posse.

In a break from Oracle and Google legal fun, I thought I'd throw this
problem out there.  We're running into a strange, what seems to be JVM-
related issue.  Given the following classes:

abstract class Inner {
   Inner() { run(); }
   public abstract void run();
}

public class Outer {
   public static void test(final String s) {
      Inner i = new Inner() {
       public void run() {
                        System.out.println("s = " + s);
            }
        };
        i.run();
    }

    public static void main(String[] args) {
        test("hello");
    }
}

Why does jre 1.4 return this:

s = null
s = hello

But jre 6 returns this:

s = hello
s = hello

We have an application targeting jre6 that is getting null pointer
exceptions from variables supposedly declared final, referenced from
inner classes.

-- 
You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=en.

Reply via email to