This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: Class.h and Class.java both define zero-arg constructor
- From: Tom Tromey <tromey at redhat dot com>
- To: Adam Megacz <gcj at lists dot megacz dot com>
- Cc: java at gcc dot gnu dot org
- Date: 16 Dec 2001 01:15:50 -0700
- Subject: Re: Class.h and Class.java both define zero-arg constructor
- References: <86wuzuo7g5.fsf@megacz.com>
- Reply-to: tromey at redhat dot com
>>>>> "Adam" == Adam Megacz <gcj@lists.megacz.com> writes:
Adam> Class.h:
Adam> // This constructor is used to create Class object for the primitive
Adam> // types. See prims.cc.
Adam> Class ()
Adam> {
Adam> [ ... ]
Adam> }
Adam> Class.java:
Adam> // Don't allow new classes to be made.
Adam> private Class ()
Adam> {
Adam> }
While investigating PR 5088, I ended up looking into this a bit more.
First, the current approach seems wrong on two counts. First,
declaring a single function with two different implementations is
invalid. Second, we currently can't have a constructor for a Java
class written in C++. We were cheating on this for Class, but really
it isn't valid.
For PR 5088 I changed how the Object constructor's name is mangled.
It turns out that the C++ Class() constructor will call the `C2'
Object constructor (obvious once you dig into the problem), but with
my renaming patch there is only a `C1' constructor.
However, at the same time if I turn the constructor in Class.h into a
declaration, the vtable ends up wrong. I don't understand why :-(.
My fix for that is to move the vtable hackery into _Jv_InitPrimClass.
Even more unfortunately, this doesn't seem to work either. More
debugging is required. But I think I'm on the right track here: get
rid of the C++ implementation.
Tom