1 2 Previous Next 19 Replies Latest reply on Mar 5, 2008 3:48 PM by kabirkhan Go to original post
      • 15. Re: aop-mc-int tests failing on annotation parsing
        alesj

         

        "adrian@jboss.org" wrote:

        Can you make sure bug reports get raised for the failing tests please.

        I'll assign an issue to Kabir for the previous (delegate vs. proxy) failures.
        And this last one to me, commenting on the 'fix' that I did.

        • 16. Re: aop-mc-int tests failing on annotation parsing
          alesj

           

          "alesj" wrote:

          I'll assign an issue to Kabir for the previous (delegate vs. proxy) failures.

          - http://jira.jboss.com/jira/browse/JBMICROCONT-250
          "alesj" wrote:

          And this last one to me, commenting on the 'fix' that I did.

          - http://jira.jboss.com/jira/browse/JBMICROCONT-251

          • 17. Re: aop-mc-int tests failing on annotation parsing
            kabirkhan

            For http://jira.jboss.com/jira/browse/JBMICROCONT-250 the problem is that we are getting a proxy created although there are no aspects. Proxies cannot have their fields set. The reason the proxy is created is that the bean used in MapAnnotationTestCase.testCustomMapPreInstantiated() has method level annotations on the bean class

            public class FromPreinstMapSimpleBean extends SimpleBean
            {
             /** The serialVersionUID */
             private static final long serialVersionUID = 1L;
            
             @MapValue(
             value = {
             @EntryValue(
             key=@Value(string = @StringValue("string1")),
             value=@Value(string = @StringValue("string2"))
             ),
             @EntryValue(
             key=@Value(string = @StringValue("string2")),
             value=@Value(string = @StringValue("string1"))
             )
             },
             keyClass = "java.lang.String",
             valueClass = "java.lang.String"
             )
             public void setPreInstantiatedMap(CustomMap preInstantiatedMap)
             {
             super.setPreInstantiatedMap(preInstantiatedMap);
             }
            ...
            }
            


            When AOPConstructorJoinPoint does its check to see if instance-level metadata exists
             private boolean hasMethodMetaData(MetaData metaData)
             {
             //Check for method annotations
             ClassInfo info = constructorInfo.getDeclaringClass();
             while (info != null)
             {
             MethodInfo[] methods = info.getDeclaredMethods();
             if (methods != null)
             {
             for (MethodInfo mi : methods)
             {
             if (methodHasAnnotations(metaData, mi))
             {
             return true;
             }
             }
             }
             info = info.getSuperclass();
             }
            
             return false;
             }
            
             private boolean methodHasAnnotations(MetaData metaData, MethodInfo mi)
             {
             MethodSignature sig = new MethodSignature(mi);
             MetaData methodMD = metaData.getComponentMetaData(sig);
             if (methodMD != null)
             {
             return methodMD.getAnnotations() != MetaData.NO_ANNOTATIONS;
             }
             return false;
             }
            


            methodHasAnnotations returns true. The methodMD contains only one retrieval, of type AnnotatedElementMetaDataLoader, which has annotations since they exist in the class itself. It should only return true if these annotations exist at instance level or lower


            • 18. Re: aop-mc-int tests failing on annotation parsing
              kabirkhan

              Modifying methodHasAnnotations to this solves the problem.

               private boolean methodHasAnnotations(MetaData metaData, MethodInfo mi)
               {
               MethodSignature sig = new MethodSignature(mi);
               MetaData methodMD = metaData.getComponentMetaData(sig);
              
               if (hasMetaDataAtInstanceLevel(methodMD))
               {
               return true;
               }
               return false;
               }
              
               private boolean hasMetaDataAtInstanceLevel(MetaData metaData)
               {
               if (metaData != null)
               {
               MetaData instanceMetaData = metaData.getScopeMetaData(CommonLevels.INSTANCE);
               if (instanceMetaData != null && instanceMetaData.isEmpty() == false)
               {
               return true;
               }
               }
               return false;
               }
              


              I will run the aop-mc-int tests before commiting

              • 19. Re: aop-mc-int tests failing on annotation parsing
                kabirkhan
                1 2 Previous Next