Bug 32342 - The field type Class_A is defined in an inherited type and an enclosing scope
Summary: The field type Class_A is defined in an inherited type and an enclosing scope
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 33505 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-20 08:27 EST by Andrea Di Muzio CLA
Modified: 2003-02-28 05:53 EST (History)
1 user (show)

See Also:


Attachments
Test case (541 bytes, application/octet-stream)
2003-02-21 09:25 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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. ***