yeecode / MyBatisCN

MyBatis中文详尽注释版。书籍《通用源码阅读指导书——MyBatis源码详解》配套注释版源码。

Home Page:http://yeecode.top

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

不明的一个注释

cnzbq opened this issue · comments

commented

这个类 org.apache.ibatis.reflection.Reflector#pickBetterSetter

image
if (paramType1.isAssignableFrom(paramType2)) { // 父类的那个为准 return setter2; } else if (paramType2.isAssignableFrom(paramType1)) { return setter1; }
这里应该是以子类的为准吧

commented

是的,我看也是:父类.isAssignableFrom(子类)

经过确认,这里注释确实出现了错误。逻辑为:
在paramType1是paramType2父类的情况下,返回setter2。即返回的是paramType2对应的setter,因此是以子类的那个为准。

谢谢两位的指正。