harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yang Paulex" <paulex.y...@gmail.com>
Subject Re: [vmi] Reflection support for generics
Date Thu, 11 Jan 2007 08:58:29 GMT
Hi, sorry for the delay, I've just got some time to look at this issue now.

I tried to move generic reflection support out from kernel class to LUNI at
first, then look at the implementation itself, like JIRA-2052 requested.

Currently I see four packages can be moved out:
o.a.h.l.reflect.implementation
o.a.h.l.reflect.parser
o.a.h.l.reflect.repository
o.a.h.l.reflect.support

But there is one utility class o.a.l.r.s.AuxiliaryChecker, which depends on
DRLVM specific org.apache.harmony.vm.VMGenericsAndAnnotations.getSignature(Class),
so we have two options:

1. Don't add VMI methods, and keep AuxiliaryChecker in kernel class, this
option is relative simple. According to class comments, AuxiliaryChecker is
to check the correspondence of the formal parameter number and the actual
argument number, I'm not sure yet about its purpose to check this during
generics reflection.

2. Add VMGenericsAndAnnotations.getSignature(Class) and
getSignature(AccessibleObject) to VMI kernel class contract, please note
that the latter method needs to be refactored from getSignature(long). This
option can enable more code sharing between different VMs, because several
wrapped class, say Class.GACache, Constructor.ConstructorData, etc, and
several other methods can be VM independent.

I've tried run tests sucessfully for both options.

>From modularity perspective, I think the latter one seems more elegant, but
it needs new API of VMI (although trivial refactory to DRLVM), so I'd like
to hear about others' comments. And also please let me know if I missed
something in DRLVM. Thank you all.

2006/12/27, Alexey Varlamov <alexey.v.varlamov@gmail.com>:
>
> There is HARMONY-2052 expressing exactly the same idea.
> Paulex, are you going to work on this?
>
> --
> Alexey
>
> 2006/12/27, Geir Magnusson Jr. <geir@pobox.com>:
> >
> > On Dec 27, 2006, at 6:00 AM, Tim Ellison wrote:
> >
> > > Paulex Yang wrote:
> > >> Hi, all
> > >>
> > >> I found that IBM VME's kernel class implementation don't fully
> > >> support
> > >> generics related reflection, more specifically, the methods below
> > >> always
> > >> return null: (Oli? would you like to confirm?)
> > >>
> > >> j.l.r.Constructor.getGenericParameterTypes()
> > >> j.l.r.Constructor.getGenericExceptionTypes()
> > >> j.l.r.Field.getGenericType()
> > >> j.l.r.Method.getGenericReturnType()
> > >> j.l.r.Method.getGenericParameterTypes()
> > >> j.l.r.Method.getGenericExceptionTypes()
> > >> java.lang.Class.GetGenericInterfaces()
> > >> java.lang.Class.GetGenericSuperclass()
> > >>
> > >> So I looked at DRLVM's j.l.r.Constructor implementation, seems most
> > >> codes related generics reflection are VM neutral, such as classes in
> > >> o.a.h.l.r.parser, except several small native methods locate in
> > >> o.a.h.v.VMGenericsAndAnnotations to access class flags, I haven't
> > >> looked
> > >> into other classes but I won't be surprised if they aren't in similar
> > >> case. If so, it makes sense to me to extract the VM independent part
> > >> into class library codes as utilities, so that IBM VME(and other
> > >> Harmony
> > >> compatible VM) can also benefit from them, one obvious drawback
> > >> may be
> > >> some new VMI methods needed to access the VM implementation details.
> > >> Because lack of enough knowledge on either IBM VME or DRLVM
> > >> implementation, I'm not sure if it is a good idea. So any comments
> > >> from
> > >> DRL gurus and others?
> > >
> > > I know that you were asking for DRL gurus, but...
> > >
> > > this makes sense to me, looking at the logic in the DRLVM-specific
> > > types
> > > it appears that we can share that non-trivial logic across VM's and
> > > reduce the VM-specific parts to retrieving the raw data and calling
> > > those helpers.
> > >
> > > The logic place for such shared types would be in
> > > o.a.h.luni.internal.reflect.  Of course, it does not preclude VMs
> > > dealing with the API entirely themselves and not delegating to the
> > > helpers if they so choose.
> >
> > +1
> >
> > >
> > > Regards,
> > > Tim
> >
> >
>



-- 
Paulex Yang
China Software Development Labotary
IBM

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message