1:nutz版本:nutz-1.r.68-20210824.1603380-150
源代码:
@Getter
@Setter
public class A {
@Name
String uuid;
}
@Getter
@Setter
public class B extends A {
@Column
String name;
}
使用 allatori 混淆之后 他会在每个class里面加入一个静态函数AllatoriDecryptString作为 字符串的加密函数
<class old="com.tk123.user.vo.B" new="com.tk123.c.n.A">
<method old="AllatoriDecryptString(Ljava/lang/Object;)Ljava/lang/String;" new="M"/>
<method old="getId()Ljava/lang/String;" new="getId"/>.
xxxx
nutzboot启动的时候会通过
org.nutz.dao.impl.entity.NutEntity:196
BornContext<T> bc = Borns.evalByArgTypes(type, ResultSet.class);
org.nutz.lang.born.Borns 150行左右
// 看看有没有对应静态工厂函数
Method[] sms = mirror.getStaticMethods();
for (Method m : sms) {
Class<?>[] pts = m.getParameterTypes();
MatchType mt = Mirror.matchParamTypes(pts, argTypes);
re.setMatchType(mt);
if (MatchType.YES == mt) {
return re.setBorning(new MethodBorning<T>(m));
} else if (MatchType.LACK == mt) {
re.setLackArg(Mirror.blankArrayArg(pts));
return re.setBorning(new MethodBorning<T>(m));
} else if (null != dynaArg && pts.length == 1) {
if (pts[0] == dynaArg.getClass()) {
return re.setBorning(new DynaMethodBorning<T>(m));
}
}
}
会找到AllatoriDecryptString 然后报异常
Caused by: org.nutz.lang.born.BorningException: Fail to born or cast to 'com.tk123.c.n.A'
by args: [@(com.alibaba.druid.pool.DruidPooledResultSet@7cb2479b)]
because:java.lang.ClassCastException: com.alibaba.druid.pool.DruidPooledResultSet cannot be cast to java.lang.String
at org.nutz.lang.born.MethodBorning.born(MethodBorning.java:20)
at org.nutz.dao.impl.entity.NutEntity.getObject(NutEntity.java:214)
at org.nutz.dao.impl.sql.pojo.PojoFetchEntityCallback.invoke(PojoFetchEntityCallback.java:21)
at org.nutz.dao.impl.jdbc.NutPojo.onAfter(NutPojo.java:114)
at org.nutz.dao.impl.sql.run.NutDaoExecutor._runSelect(NutDaoExecutor.java:280)
这种问题如何解决呐?