[jboss-dev-forums] [Design the new POJO MicroContainer] - New behaviour of AbstractMetaDataContext.isEmpty()
kabir.khan@jboss.com
do-not-reply at jboss.com
Thu Nov 15 12:56:50 EST 2007
This code in AOPConstructorJoinpoint
| private boolean hasInstanceOrJoinpointMetaData(MetaData metaData)
| {
| if (metaData == null)
| {
| return false;
| }
|
| MetaData instanceMetaData = metaData.getScopeMetaData(CommonLevels.INSTANCE);
| if (instanceMetaData != null && instanceMetaData.isEmpty() == false)
| {
| return true;
| }
| //Check for method annotations
| return hasMethodMetaData(metaData);
| }
|
The instanceMetaData.isEmpty() check used to return false for the following case:
| @Test
| public class AnnotatedChild extends Base
| {
| public static boolean childInvoked;
| public void childOnly()
| {
| childInvoked = true;
| }
|
| public void baseOverridden()
| {
| childInvoked = true;
| }
| }
|
| <deployment xmlns="urn:jboss:bean-deployer:2.0">
|
| ...
| <bean name="AnnotatedChild" class="org.jboss.test.microcontainer.matrix.AnnotatedChild"/>
| </deployment>
|
It now returns true, this breaks loads of the aop/mc int tests.
The instanceMetaData.toString() method shows
| org.jboss.metadata.spi.retrieval.MetaDataRetrievalToMetaDataBridge at 1286c00{[JVM=THIS, CLASS=org.jboss.test.microcontainer.matrix.AnnotatedChild, INSTANCE=AnnotatedChild, WORK=1209895]}
|
and stepping into the isEmpty() method, the retrieval/MemoryMetaDataLoader with ScopeKey:
[INSTANCE=AnnotatedChild] is empty, but it then calls isEmpty() on the parent MetaDataContext, which contains the following retrievals and associated SkopeKeys
| MemoryMetaDataLoader [WORK=1209895]
| MemoryMetaDataLoader [INSTANCE=AnnotatedChild]
| AnnotatedElementMetaDataLoader [CLASS=org.jboss.test.microcontainer.matrix.AnnotatedChild]
| MemoryMetaDataLoader [JVM=THIS]
|
The CLASS level one has annotations, so isEmpty() ends up returning false.
Is this a bug or should I be checking if it is empty another way?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4105149#4105149
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4105149
More information about the jboss-dev-forums
mailing list