本文整理匯總了Java中org.objectweb.asm.commons.Method.getName方法的典型用法代碼示例。如果您正苦於以下問題:Java Method.getName方法的具體用法?Java Method.getName怎麽用?Java Method.getName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.objectweb.asm.commons.Method
的用法示例。
在下文中一共展示了Method.getName方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findCallHierarchy
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
/**
* Find call hierarchy of <b>methodSignature</b> of the class <b>className</b> or any subclass
* @param className the full class name. ex: "java/lang/Integer"
* @param methodSignature method signature. ex: "java.lang.Integer methodName(java.lang.Integer)"
* @return a CallHierarchy starting with the parameter method
* @throws IOException if an I/O error has occurred
*/
public CallHierarchy findCallHierarchy( String className, String methodSignature ) throws IOException {
String methodName = "";
String methodDesc = "";
if( methodSignature != null ){
Method method = Method.getMethod(methodSignature);
methodName = method.getName();
methodDesc = method.getDescriptor();
}
CallHierarchy callHierarchy = new CallHierarchy(null, className, methodName, methodDesc);
findCallHierarchy( callHierarchy );
return callHierarchy;
}
示例2: MethodWriter
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
public MethodWriter(int access, Method method, ClassVisitor cw, BitSet statements, CompilerSettings settings) {
super(Opcodes.ASM5, cw.visitMethod(access, method.getName(), method.getDescriptor(), null, null),
access, method.getName(), method.getDescriptor());
this.statements = statements;
this.settings = settings;
}
示例3: addSupportMethod
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
public void addSupportMethod() {
int access = Opcodes.ACC_PUBLIC;
Method m = new Method("isSupport", "(I)Z");
MethodVisitor mv = super.visitMethod(access,
m.getName(),
m.getDescriptor(),
null, null);
mv.visitCode();
mv.visitVarInsn(Opcodes.ALOAD, 1);
// mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "hashCode", "()I", false);
int[] hashArray = new int[fixMtds.size()];
Label[] labelArray = new Label[fixMtds.size()];
Label l0 = new Label();
Label l1 = new Label();
for (int i = 0; i < fixMtds.size(); i++) {
hashArray[i] = AcesoProguardMap.instance().getClassData(visitedClassName).getMtdIndex(fixMtds.get(i));
labelArray[i] = l0;
}
mv.visitLookupSwitchInsn(l1, hashArray, labelArray);
mv.visitLabel(l0);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitInsn(Opcodes.ICONST_1);
mv.visitInsn(Opcodes.IRETURN);
mv.visitLabel(l1);
mv.visitFrame(Opcodes.F_SAME, 0, null, 0, null);
mv.visitInsn(Opcodes.ICONST_0);
mv.visitInsn(Opcodes.IRETURN);
mv.visitMaxs(1, 2);
mv.visitEnd();
mv.visitMaxs(0, 0);
mv.visitEnd();
}
示例4: findCallersOfMethod
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
/**
* Find callers of <b>methodSignature</b> of the class <b>className</b> or any subclass
* @param className the full class name. ex: "java/lang/Integer"
* @param methodSignature method signature. ex: "java.lang.Integer methodName(java.lang.Integer)"
* @return a Set with the callers or a empty Set if no one was found
* @throws IOException if an I/O error has occurred
*/
public Set<JavaMethod> findCallersOfMethod( String className, String methodSignature ) throws IOException {
String methodName = "";
String methodDesc = "";
if( methodSignature != null ){
Method method = Method.getMethod(methodSignature);
methodName = method.getName();
methodDesc = method.getDescriptor();
}
return findCallersOfMethod( className, methodName, methodDesc );
}
示例5: MethodBuilder
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
public MethodBuilder(int accessFlag, Method method, ClassVisitor cv) {
super(Opcodes.ASM5, toMethodVisitor(accessFlag, method, cv), accessFlag, method.getName(), method.getDescriptor());
this.loopLabels = new ArrayDeque<>();
this.tryLabels = new ArrayDeque<>();
int startIndex = 0;
if ((accessFlag & Opcodes.ACC_STATIC) != Opcodes.ACC_STATIC) {
startIndex = 1;
}
this.varScopes = new VarScopes(startIndex);
this.method = method;
}
示例6: generateRun
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
private static void generateRun(ClassVisitor cv, Type testType, List<Actor> actors, List<Object> objArgs, boolean waitsEnabled) {
int access = ACC_PUBLIC;
Method m = new Method("call", RESULT_ARRAY_TYPE, NO_ARGS);
GeneratorAdapter mv = new GeneratorAdapter(access, m,
// Try-catch blocks sorting is required
new TryCatchBlockSorter(cv.visitMethod(access, m.getName(), m.getDescriptor(), null, null),
access, m.getName(), m.getDescriptor(), null, null)
);
mv.visitCode();
// Create Result[] array and store it to a local variable
int resLocal = createResultArray(mv, actors.size());
// Wait for other threads
arriveAndAwaitAdvance(mv);
// Number of current operation (starts with 0)
int iLocal = mv.newLocal(Type.INT_TYPE);
mv.push(0);
mv.storeLocal(iLocal);
// Invoke actors
for (int i = 0; i < actors.size(); i++) {
Actor actor = actors.get(i);
// Add busy-wait before operation execution (for non-first operations only)
if (waitsEnabled && i > 0) {
mv.loadThis();
mv.getField(TEST_THREAD_EXECUTION_TYPE, "waits", INT_ARRAY_TYPE);
mv.push(i - 1);
mv.arrayLoad(Type.INT_TYPE);
mv.invokeStatic(UTILS_TYPE, UTILS_CONSUME_CPU);
}
// Start of try-catch block for exceptions which this actor should handle
Label start, end = null, handler = null, handlerEnd = null;
if (actor.handlesExceptions()) {
start = mv.newLabel();
end = mv.newLabel();
handler = mv.newLabel();
handlerEnd = mv.newLabel();
for (Class<? extends Throwable> ec : actor.handledExceptions)
mv.visitTryCatchBlock(start, end, handler, Type.getType(ec).getInternalName());
mv.visitLabel(start);
}
// Load result array and index to store the current result
mv.loadLocal(resLocal);
mv.push(i);
// Load test instance
mv.loadThis();
mv.getField(TEST_THREAD_EXECUTION_TYPE, "testInstance", OBJECT_TYPE);
mv.checkCast(testType);
// Load arguments for operation
for (int j = 0; j < actor.arguments.length; j++) {
pushArgumentOnStack(mv, objArgs, actor.arguments[j], actor.method.getParameterTypes()[j]);
}
// Invoke operation
Method actorMethod = Method.getMethod(actor.method);
mv.invokeVirtual(testType, actorMethod);
// Create result
mv.box(actorMethod.getReturnType()); // box if needed
if (actor.method.getReturnType() == void.class) {
mv.pop();
mv.invokeStatic(RESULT_TYPE, RESULT_CREATE_VOID_RESULT);
} else {
mv.invokeStatic(RESULT_TYPE, RESULT_CREATE_VALUE_RESULT);
}
// Store result to array
mv.arrayStore(RESULT_TYPE);
// End of try-catch block
if (actor.handlesExceptions()) {
mv.visitLabel(end);
mv.goTo(handlerEnd);
mv.visitLabel(handler);
storeExceptionResultFromThrowable(mv, resLocal, iLocal);
mv.visitLabel(handlerEnd);
}
// Increment number of current operation
mv.iinc(iLocal, 1);
}
// Return results
mv.loadThis();
mv.loadLocal(resLocal);
mv.returnValue();
mv.visitMaxs(1, 1);
mv.visitEnd();
}
示例7: toMethodVisitor
import org.objectweb.asm.commons.Method; //導入方法依賴的package包/類
/**
* helper method for method visitor generation
*
* @param access
* @param method
* @param cv
* @return
*/
private static MethodVisitor toMethodVisitor(int access, Method method, ClassVisitor cv) {
MethodVisitor visitor = cv.visitMethod(access, method.getName(), method.getDescriptor(), null, null);
JSRInlinerAdapter inlinerAdapter = new JSRInlinerAdapter(visitor, access, method.getName(), method.getDescriptor(), null, null);
return inlinerAdapter;
// return visitor;
}