Re: Class.newInstance always locates default constructor

Date view Thread view Subject view Author view

From: Godmar Back (gback@cs.utah.edu)
Date: Tue Oct 27 1998 - 13:43:35 EST


 Note I changed the recipients to kaffe-core.
I'm not sure if the feedback of the whole list is needed on this,
as it's simply a bug and not necessary a design or compatibility
issue that affects others.

>
> Given the attached code snippet, Kaffe will fail to throw a
> NoSuchMethodException because execute_java_constructor calls
> lookupClassMethod, that calls findMethod, that ends up finding the
> constructor <init>()V in superclasses, for example, in
> java.lang.Object.
>
> I can see two ways to fix this:
>
> 1) modify findMethod so that it strcmp()s name with
> makeUtf8Const(constructor_name->data,-1), and behaves differently for
> constructors
>
> 2) create lookupConstructor and findConstructor, and modify
> execute_java_constructor_v to use lookupConstructor instead of
> lookupClassMethod.
>
> I seem to prefer the second alternative. What do others think?
>

What about
having a lookupClassMethodLocal that calls findMethodLocal,
just like lookupClassMethod calls findMethod?

Then the execute_java_constructor function could call lookupClassMethodLocal
instead of findMethod.

        - Godmar


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 19:57:01 EDT