![JAR search and dependency download from the Maven repository](/logo.png)
com.github.andyshao.asm.ClassVisitorOperation Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Gear Show documentation
Show all versions of Gear Show documentation
Enhance and formating the coding of JDK
The newest version!
package com.github.andyshao.asm;
import java.lang.reflect.Method;
/**
*
* Title:
* Descript:
* Copyright: Copryright(c) Apr 20, 2016
* Encoding:UNIX UTF-8
*
* @author Andy.Shao
*
*/
public final class ClassVisitorOperation {
/**
* count basic local
* @param method {@link Method}
* @return the number of basic local
*/
public static final int countBasicLocal(Method method) {
int result = method.getParameterCount() + 1;
Class>[] types = method.getParameterTypes();
for (Class> parameter : types)
if (long.class.isAssignableFrom(parameter) || double.class.isAssignableFrom(parameter)) result++;
return result;
}
/**
* count basic stack
* @param method {@link Method}
* @return the number of basic stack
*/
public static final int countBasicStack(Method method) {
Class> type = method.getReturnType();
if (type.isPrimitive()) {
if (long.class.isAssignableFrom(type) || double.class.isAssignableFrom(type)) return 2;
else if (void.class.isAssignableFrom(type)) return 0;
else return 1;
} else return 1;
}
private ClassVisitorOperation() {
throw new AssertionError("No " + ClassVisitorOperation.class + " instance for you");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy