private static void createMetaMethods(final Class extensionClass, final List<MetaMethod> metaMethods, final boolean isStatic) { CachedClass cachedClass = ReflectionCache.getCachedClass(extensionClass); CachedMethod[] methods = cachedClass.getMethods(); for (CachedMethod method : methods) { if (method.isStatic() && method.isPublic() && method.getParamsCount() > 0) { // an extension method is found metaMethods.add(isStatic?new NewStaticMetaMethod(method) : new NewInstanceMetaMethod(method)); } } }
if (!method.isStatic() || !method.isPublic()) continue;
private void applyUse(CachedClass cachedClass) { CachedMethod[] methods = cachedClass.getMethods(); for (CachedMethod cachedMethod : methods) { if (cachedMethod.isStatic() && cachedMethod.isPublic()) { CachedClass[] paramTypes = cachedMethod.getParameterTypes(); if (paramTypes.length > 0) { CachedClass metaClass = paramTypes[0]; CategoryMethod mmethod = new CategoryMethod(cachedMethod, metaClass.getTheClass()); final String name = cachedMethod.getName(); CategoryMethodList list = get(name); if (list == null || list.level != level) { list = new CategoryMethodList(name, level, list); put(name, list); } list.add(mmethod); Collections.sort(list); cachePropertyAccessor(mmethod); } } } }
if (cachedMethod.isStatic()) { invokeMethodCode = Opcodes.INVOKESTATIC; } else {
if (cachedMethod.isStatic()) { invokeMethodCode = Opcodes.INVOKESTATIC; } else {
if (cachedMethod.isStatic()) { invokeMethodCode = Opcodes.INVOKESTATIC; } else {
continue; if(cm.isStatic()){ continue;
continue; if(cm.isStatic()){ continue;
for (int i = 0, cur = 0; i < cachedMethods.length; i++) { CachedMethod method = cachedMethods[i]; if (!method.isStatic() || !method.isPublic()) continue;
for (int i = 0, cur = 0; i < cachedMethods.length; i++) { CachedMethod method = cachedMethods[i]; if (!method.isStatic() || !method.isPublic()) continue;
if (!method.isStatic() || !method.isPublic()) continue;
private void applyUse(CachedClass cachedClass) { CachedMethod[] methods = cachedClass.getMethods(); for (CachedMethod cachedMethod : methods) { if (cachedMethod.isStatic() && cachedMethod.isPublic()) { CachedClass[] paramTypes = cachedMethod.getParameterTypes(); if (paramTypes.length > 0) { CachedClass metaClass = paramTypes[0]; CategoryMethod mmethod = new CategoryMethod(cachedMethod, metaClass.getTheClass()); final String name = cachedMethod.getName(); CategoryMethodList list = get(name); if (list == null || list.level != level) { list = new CategoryMethodList(name, level, list); put(name, list); } list.add(mmethod); Collections.sort(list); } } } }
private void applyUse(CachedClass cachedClass) { CachedMethod[] methods = cachedClass.getMethods(); for (int i = 0; i < methods.length; i++) { CachedMethod cachedMethod = methods[i]; if (cachedMethod.isStatic() && cachedMethod.isPublic()) { CachedClass[] paramTypes = cachedMethod.getParameterTypes(); if (paramTypes.length > 0) { CachedClass metaClass = paramTypes[0]; CategoryMethod mmethod = new CategoryMethod(cachedMethod, metaClass.getTheClass()); final String name = cachedMethod.getName(); CategoryMethodList list = get(name); if (list == null || list.level != level) { list = new CategoryMethodList(name,level,list); put (name, list); } list.add(mmethod); Collections.sort(list); } } } }
private void applyUse(CachedClass cachedClass) { CachedMethod[] methods = cachedClass.getMethods(); for (CachedMethod cachedMethod : methods) { if (cachedMethod.isStatic() && cachedMethod.isPublic()) { CachedClass[] paramTypes = cachedMethod.getParameterTypes(); if (paramTypes.length > 0) { CachedClass metaClass = paramTypes[0]; CategoryMethod mmethod = new CategoryMethod(cachedMethod, metaClass.getTheClass()); final String name = cachedMethod.getName(); CategoryMethodList list = get(name); if (list == null || list.level != level) { list = new CategoryMethodList(name, level, list); put(name, list); } list.add(mmethod); Collections.sort(list); cachePropertyAccessor(mmethod); } } } }
protected void invokeMethod(CachedMethod method, MethodVisitor mv) { // compute class to make the call on Class callClass = method.getDeclaringClass().getTheClass(); boolean useInterface = callClass.isInterface(); // if (callClass == null) { // callClass = method.getCallClass(); // } else { // useInterface = true; // } // get bytecode information String type = BytecodeHelper.getClassInternalName(callClass.getName()); String descriptor = BytecodeHelper.getMethodDescriptor(method.getReturnType(), method.getNativeParameterTypes()); // make call if (method.isStatic()) { loadParameters(method, 3, mv); mv.visitMethodInsn(INVOKESTATIC, type, method.getName(), descriptor); } else { mv.visitVarInsn(ALOAD, 2); helper.doCast(callClass); loadParameters(method, 3, mv); mv.visitMethodInsn((useInterface) ? INVOKEINTERFACE : INVOKEVIRTUAL, type, method.getName(), descriptor); } helper.box(method.getReturnType()); }
if (cachedMethod.isStatic()) { invokeMethodCode = Opcodes.INVOKESTATIC; } else {