Community
Participate
Working Groups
I got a "The field type Class_A is defined in an inherited type and an enclosing scope" in the following code: package foo; public class Concrete_foo_class extends Abstract_foo_class { private static Concrete_foo_class c_Instance = null; <--- Here I get the error!! public static Concrete_foo_class getDefault(){ if (c_Instance == null){ c_Instance = new Concrete_foo_class(); } return c_Instance; } ... } The abstract class Abstract_foo_class is defined in a different package. The strangest thing is that I have other classes with exactly the same structure (auto-generated classes), which do not have any compilation problem.
Does 'Abstract_foo' also define a field 'c_Instance' ? If so, what modifiers does it have ?
Abstract_foo does not define c_Instance but looking at it I discovered why the error arrives only on Contrete_foo_class and not on (as example) VeryLarge_foo_class that has the same structure. The problem is that in Abstract_foo there is a private static class called Contrete_foo_class: public abstract class Abstract_foo_class{ private static class Concrete_foo_class extends Abstract_foo_class{ ... } } I'm going to change the name of the inner class, this will allow me to compile. BTW I think that there is a bug in M5 since the inner class is private and should not be visible outside Abstract_foo_class.
I attach a small test case that shows the problem. Javac1.4.1 and jikes 1.18 compile this code ok.
Created attachment 3627 [details] Test case
Issue is identified, this is a regression since 2.1-M4 (consequence of bug 30705). Fix released for RC1.
Verified.
*** Bug 33505 has been marked as a duplicate of this bug. ***