Class.newInstance always locates default constructor

Alexandre Oliva oliva at dcc.unicamp.br
Tue Oct 27 10:32:06 PST 1998


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?

-- 
Alexandre Oliva
mailto:oliva at dcc.unicamp.br mailto:oliva at gnu.org mailto:aoliva at acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.java
Type: application/octet-stream
Size: 190 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/19981027/3d09fa30/attachment-0007.obj 


More information about the kaffe mailing list