Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-dev] FW: [metadata-jsr] Reflection API: which classloader?

Does someone here want to send me a comment on this that I
can forward to jsr-175?

-----Original Message-----
From: metadata-jsr-admin@xxxxxxxxxxxxx
[mailto:metadata-jsr-admin@xxxxxxxxxxxxx] On Behalf Of Doug Lea
Sent: Saturday, February 28, 2004 5:23 PM
To: metadata-jsr@xxxxxxxxxxxxxxxxxxxx
Subject: Re: [metadata-jsr] Reflection API: which classloader?


I had a conversation with Neal Gafter about the class loader issue in
which he rubbed off just enough of his paranoia fear of the unknown
:-) to make me want to bring it up again.

Recall that the issue is that you could have an AnnotatedElement e
(i.e., some Class, Constructor, Field, Method, or Package), for which
  e.getAnnotations();
might not return some or all annotations because they were loaded
using some other class loader than the one the caller is using.

I suspect this discussion didn't get too far because most of us think
that the less said here or anywhere about class loaders the better.
But I also know that some frameworks out there use different class
loaders for all sorts of odd purposes. And so have a lingering worry
that Neal's main use-case ...

>  For example, one might wish to have a single annotation processing
> facility present in its own class loader but supporting processing
> of that annotation for a number of subsystems, each in its own class
> loader.

... might actually be needed somewhere in AOP or J2EE frameworks.

Cedric, Simon, and Gregor: Could you possibly ask around and see what
people building WebLogic, Websphere, AspectJ frameworks think about
this?  Ted already asked at Oracle, and they are happy not to have the
ability to do this.  My guess is that others will say either that they
don't need it either, or that it might be nice to have but not
essential.

If this is so, I think we can safely drop the issue in JSR175, because
there is a pretty good story about how to add support if it ever
becomes necessary: Just add overloaded method
    AnnotatedElement.getAnnotations(ClassLoader cl)
that returns all annotations available from the given class loader.
This would be a simple addition API-wise, although not
implementation-wise, because big chunks of the current implementation
would need changing to lazily resolve an AnnotatedElement with respect
to the class loader that it carries around.

Further, while I think it is important to find out now if anyone
believes that this IS essential, we in JSR175 probably can't in good
conscience demand that it be added now.  If we did, it would be at
most incompletely implemented (i.e., buggy) in JDK1.5, which would not
do anyone a favor. However, the knowledge that there will be an RFE
for adding the method might enable some short-term adjustments to make
it easier to put in later.

-Doug

_______________________________________________
metadata-jsr mailing list
metadata-jsr@xxxxxxxxxxxxxxxxxxxx
http://altair.cs.oswego.edu/mailman/listinfo/metadata-jsr


_______________________________________________
metadata-jsr mailing list
metadata-jsr@xxxxxxxxxxxxxxxxxxxx
http://altair.cs.oswego.edu/mailman/listinfo/metadata-jsr




Back to the top