本文整理汇总了Java中java.lang.reflect.Executable.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Executable.getName方法的具体用法?Java Executable.getName怎么用?Java Executable.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.lang.reflect.Executable
的用法示例。
在下文中一共展示了Executable.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ClassVisitorForLabels
import java.lang.reflect.Executable; //导入方法依赖的package包/类
public ClassVisitorForLabels(ClassWriter cw, Map<Label, Integer> lines,
Executable target) {
super(Opcodes.ASM5, cw);
this.lineNumbers = lines;
StringBuilder builder = new StringBuilder("(");
for (Parameter parameter : target.getParameters()) {
builder.append(Utils.toJVMTypeSignature(parameter.getType()));
}
builder.append(")");
if (target instanceof Constructor) {
targetName = "<init>";
builder.append("V");
} else {
targetName = target.getName();
builder.append(Utils.toJVMTypeSignature(
((Method) target).getReturnType()));
}
targetDesc = builder.toString();
}
示例2: runSanityTest
import java.lang.reflect.Executable; //导入方法依赖的package包/类
private static void runSanityTest(Executable aMethod, int[] bcis) {
HotSpotResolvedJavaMethod method = CTVMUtilities
.getResolvedMethod(aMethod);
String className = aMethod.getDeclaringClass().getName();
String methodName = aMethod.getName().equals(className)
? "<init>"
: aMethod.getName();
String fileName = getFileName(className);
Map<Integer, Integer> bciWithLineNumber = CTVMUtilities
.getBciToLineNumber(aMethod);
boolean isNative = Modifier.isNative(aMethod.getModifiers());
int lineNumber = -1;
for (int bci : bcis) {
StackTraceElement ste = CompilerToVMHelper
.getStackTraceElement(method, bci);
Asserts.assertNotNull(ste, aMethod + " : got null StackTraceElement"
+ " at bci " + bci);
Asserts.assertEQ(className, ste.getClassName(), aMethod
+ " : unexpected class name");
Asserts.assertEQ(fileName, ste.getFileName(), aMethod
+ " : unexpected filename");
Asserts.assertEQ(methodName, ste.getMethodName(), aMethod
+ " : unexpected method name");
Asserts.assertEQ(isNative, ste.isNativeMethod(), aMethod
+ " : unexpected 'isNative' value");
if (bciWithLineNumber.size() > 0) {
if (bciWithLineNumber.containsKey(bci)) {
lineNumber = bciWithLineNumber.get(bci);
}
Asserts.assertEQ(lineNumber, ste.getLineNumber(), aMethod
+ " : unexpected line number");
} else {
// native and abstract function
Asserts.assertGT(0, ste.getLineNumber(),
aMethod + " : unexpected line number for abstract "
+ "or native method");
}
}
}
示例3: MethodType
import java.lang.reflect.Executable; //导入方法依赖的package包/类
public MethodType(Executable method) {
// Use pack/subpack/Class::method separators style
super(MethodDescriptor.Separator.DOT);
if (method instanceof Constructor) {
element = "<init>";
} else {
element = method.getName();
}
regexp = element;
}