protected abstract MethodEntity foundMethodWithNoArguments();
protected MethodEntity foundMethodWithNoArguments(Class<?> cls){
if(cls.isPrimitive()){
throw new ASMSupportException("cannot invoke method in prmitive");
}
Class<?> actually = cls;
MethodEntity me;
for(; actually != null ;){
try {
AClass methodReturnType = null;
int methodMidifiers;
AClass[] exceptionTypes;
if(name.equals(ASConstant.INIT)){
Constructor<?> constructor = actually.getDeclaredConstructor();
methodMidifiers = constructor.getModifiers();
exceptionTypes = convertToAClass(constructor.getExceptionTypes());
}else{
Method method = actually.getDeclaredMethod(name);
methodReturnType = AClassFactory.getProductClass(method.getReturnType());
methodMidifiers = method.getModifiers();
exceptionTypes = convertToAClass(method.getExceptionTypes());
}
AClass invoked = AClassFactory.getProductClass(cls);
AClass actuallyInvoked = AClassFactory.getProductClass(actually);
if(!AClassUtils.visible(invoker, invoked, actuallyInvoked, methodMidifiers)){
throw new ASMSupportException("cannot invoke method by the modifiers " + Modifier.toString(methodMidifiers));
}
me = new MethodEntity(name,invoked, actuallyInvoked,
null, null, methodReturnType, exceptionTypes, methodMidifiers);