You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "revolyw (via GitHub)" <gi...@apache.org> on 2023/04/21 07:39:57 UTC

[GitHub] [dubbo] revolyw commented on issue #1101: Compile error.

revolyw commented on issue #1101:
URL: https://github.com/apache/dubbo/issues/1101#issuecomment-1517407579

   这个问题是因为 dubbo 在使用 javassist 动态编译 provider 类的 getter 方法时,选择类属性识别以及返回值转换处理逻辑不够健壮导致的。
   关键源码在 org.apache.dubbo.common.bytecode.Wrapper#makeWrapper 这里,识别 provider 目标方法使用的正则是 org.apache.dubbo.common.utils.ReflectUtils#GETTER_METHOD_DESC_PATTERN ,即 get 开头,入参为空的方法的后缀将识别为属性。 
   针对这种属性动态编译 getter 方法时,待编译源码声明返回值为 Object (public Object getPropertyValue(Object o, String n)),javassist 编译器在翻译字节码阶段发现待编译源码和方法返回值不相符,字节码操作数栈对不齐,所以就报错了
   
   因此理论上没有入参/返回值为空的 get 前缀开头的方法都有这个问题


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org