[jboss-dev-forums] [Design of AOP on JBoss (Aspects/JBoss)] - Re: AOPConstructorJoinpoint and methodHasSubInstanceMetaData

kabir.khan@jboss.com do-not-reply at jboss.com
Wed Jul 23 11:27:57 EDT 2008


I'll hazard a guess

The original MethodInfo comes from AOPConstructorJoinPoint

  |    private boolean rootHasMethodWithSubInstanceMetaData(MetaData metaData)
  |    {
  |         ....
  |          MethodInfo[] methods = info.getDeclaredMethods();
  |          if (methods != null)
  |          {
  |             for (MethodInfo mi : methods)
  |             {
  |                if (methodHasSubInstanceMetaData(metaData, mi))
  |                {
  |                   return true;
  |                }
  |             }
  |          }
  |        ---
  |    }
  | 
Are the semantics of MethodInfo.getDeclaredMethods() the same as of Class.getDeclaredMethods()? In that case it would return private and protected methods, so these would get passed in to AnnotatedElementMetaDataLoader. getComponentMetaDataRetrieval() which in turn calls Class.getMethod(), which will fail on anything non-public.

  |    public MetaDataRetrieval getComponentMetaDataRetrieval(Signature signature)
  |    {
  |        ...  
  |        else if (signature instanceof MethodSignature)
  |          {
  |             try
  |             {
  |                Method method = clazz.getMethod(signature.getName(), signature.getParametersTypes(clazz));
  |                return new AnnotatedElementMetaDataLoader(method);
  |             }
  |             catch (NoSuchMethodException e)
  |             {
  |                return null;
  |             }
  |          }
  |      }
  |   }
  | 
Changing that to use class.getDeclaredMethod() might fix this

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4166192#4166192

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4166192



More information about the jboss-dev-forums mailing list