[Design of OSGi Integration] - Re: Why Class.forName sucks!
by adrian@jboss.org
It doesn't just suck, it is evil. It caches things it shouldn't.
We were forced into it for java6 array problem. But its only really required
if the classname looks like an array class.
You changed too much for this. e.g. you changed all the classloader
stuff, even though the entry point loadClass() already has the checking.
| if (classNameLooksLikeAnError)
| useClassForName();
| else
| loadClassFromClassLoaderNormally();
|
But you can't rely on our classloader being the entry point all the time,
so a helper class that does this would be ok.
i.e. invoke the helper doing the code above instead of Class.forName() directly.
Another workaround would be to byte code weave all classes using
Class.forName() to our helper using a Transformer on the classloader.
The ironic part is that Java6 on Sun has a rewritten constraint checker that is
much faster. ;-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133925#4133925
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133925
16 years, 3 months
[Design the new POJO MicroContainer] - Re: aop-mc-int tests failing on annotation parsing
by alesj
"adrian(a)jboss.org" wrote :
| I don't really understand this? The test was added at the same time as a change
| to the AOPConstructorJoinpoint (so it must have worked at some point unless
| I'm stupid? :-)
|
| The test hasn't changed since, but the joinpoint factory has changed a lot.
|
| Choose one of:
| * the test only worked by fluke and later fixes found the problem - so it started failing
| and nobody raised an issue
| * or the test never worked - and its been failing for 14 months without comment
|
I have no idea how this ever worked - with AOP enabled. :-)
Since it does exactly what I wrote.
I don't see where you could pull out non-null MetaData, after you mask it in the AOPConstructorJoinpoint, and all you have is
| public static void peekMetaData()
| {
| peekedMetaData = MetaDataStack.peek();
| }
|
in AbstractMetaDataTest.
Who's only usage is in TestClassAnnotation constructor.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133924#4133924
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133924
16 years, 3 months
[Design the new POJO MicroContainer] - Re: aop-mc-int tests failing on annotation parsing
by adrian@jboss.org
"alesj" wrote : "alesj" wrote :
| | "adrian(a)jboss.org" wrote :
| | | It's strange that these are all annotation tests?????
| | |
| | Yup, looks like my fault. :-)
| And this one - ClassAnnotationTestCase - is all yours. :-)
|
| You are peeking MetaData in the TestClassAnnotation constructor.
| And in the test you expect this MetaData not to be null - assertPeekedMetaData.
| But the AOPConstructorJoinpoint masks the MetaData just before it creates the instance.
|
I don't really understand this? The test was added at the same time as a change
to the AOPConstructorJoinpoint (so it must have worked at some point unless
I'm stupid? :-)
The test hasn't changed since, but the joinpoint factory has changed a lot.
Choose one of:
* the test only worked by fluke and later fixes found the problem - so it started failing
and nobody raised an issue
* or the test never worked - and its been failing for 14 months without comment
Either way, it doesn't fill me confidence. ;-(
It's a stupid test anyway. The purpose is to make sure the metadata
is populated properly from the class/xml
It uses the push of the metadata (for AOP to pickup under the wire) to get this information.
It would be the same if it just did:
ControllerContext context = .assertInstalledContext("name");
ScopeKey scope = context.getScopeInfo()...;
MetaData md = repository.getMetaData(scope);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4133919#4133919
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4133919
16 years, 3 months