Hi, I was just pointed to a strange thing in javas anonymous class features. Consider the following class: package javabug; public class NormalTestClass { final Integer i; //mark NormalTestClass() { i = 101; //mark foo(); } public void foo() { } } When you create an anonyous class like final Integer i = 100; NormalTestClass myClass = new NormalTestClass() { @Override public void foo() { System.err.println(i); } }; Instead of 100 the output would be 101. The problem is that we had discussed a case that used to occur in older versions of java when you removed the marked lines: In that case in the first call of foo() the variable i would not yet be initialised and therefore be null. This is fixed now. But what you get now is problematic on its own: Effectively you are forced into not using variables that are privately used by the superclass (you might not even know of). Any comments on this issue?
Attachment:
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
-- fedora-devel-java-list mailing list fedora-devel-java-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/fedora-devel-java-list