Bug 32342

Summary: The field type Class_A is defined in an inherited type and an enclosing scope
Product: [Eclipse Project] JDT Reporter: Andrea Di Muzio <a.dimuzio>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse
Version: 2.1   
Target Milestone: 2.1 RC1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Test case none

Description Andrea Di Muzio CLA 2003-02-20 08:27:57 EST
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.
Comment 1 Philipe Mulet CLA 2003-02-21 02:52:13 EST
Does 'Abstract_foo' also define a field 'c_Instance' ? If so, what modifiers 
does it have ?
Comment 2 Andrea Di Muzio CLA 2003-02-21 03:53:12 EST
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.
Comment 3 Olivier Thomann CLA 2003-02-21 09:25:14 EST
I attach a small test case that shows the problem.
Javac1.4.1 and jikes 1.18 compile this code ok.
Comment 4 Olivier Thomann CLA 2003-02-21 09:25:47 EST
Created attachment 3627 [details]
Test case
Comment 5 Philipe Mulet CLA 2003-02-21 10:44:16 EST
Issue is identified, this is a regression since 2.1-M4 (consequence of bug 
30705).

Fix released for RC1.
Comment 6 David Audel CLA 2003-02-25 07:44:42 EST
Verified.
Comment 7 Philipe Mulet CLA 2003-02-28 05:53:30 EST
*** Bug 33505 has been marked as a duplicate of this bug. ***