}
@Override
public MethodEntity firstPhase() {
MethodEntity me4ReallyClass = determineMostSpecificMethodEntity(determineMethodInJavaClass(invoker, methodOwner.getReallyClass(), name, argumentTypes, allArgTypes));
if(!CollectionUtils.isEmpty(methodOwner.getMethods())){
//find in current class
List<Method> methods = new ArrayList<Method>(methodOwner.getMethods());
//Collections.copy(methods, methodOwner.getMethods());
TypeTreeNode[] ttns;
//所有找到的可能的方法
List<MethodEntityTypeTreeNodeCombine> foundCombine = new ArrayList<MethodEntityTypeTreeNodeCombine>();
//参数是否和传入的参数相同
boolean sameToPass = true;
MethodEntity mte;
for(int i=0, length = allArgTypes.size(); i<length; i++){
ttns = allArgTypes.get(i);
for(int k=0, mlen = methods.size(); k<mlen; k++){
mte = methods.get(k).getMethodEntity();
//如果名字不相同直接跳过
if(!name.equals(mte.getName())){
continue;
}
AClass[] mtdArgs = mte.getArgClasses();
//如果参数个数不同直接跳过
if(mtdArgs.length != ttns.length){
continue;
}
//如果有一个参数的类型不同直接跳过
for(int j=0; j<ttns.length; j++){
if(!ttns[j].type.equals(mtdArgs[j])){
sameToPass = false;
continue;
}
}
if(i == 0 && sameToPass){
return mte;
}
methods.remove(k);
foundCombine.add(new MethodEntityTypeTreeNodeCombine(mte, allArgTypes.remove(i)));
length--;
break;
}
}
MethodEntityTypeTreeNodeCombine[] mettncs = foundCombine.toArray(new MethodEntityTypeTreeNodeCombine[foundCombine.size()]);
MethodEntity me4newCreateMethod = determineMostSpecificMethodEntity(mettncs);
if(me4ReallyClass == null && me4newCreateMethod != null){
return me4newCreateMethod;
}else if(me4ReallyClass != null && me4newCreateMethod == null){
return me4ReallyClass;