本文整理汇总了Java中jdk.nashorn.internal.codegen.types.Type.getMethodDescriptor方法的典型用法代码示例。如果您正苦于以下问题:Java Type.getMethodDescriptor方法的具体用法?Java Type.getMethodDescriptor怎么用?Java Type.getMethodDescriptor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jdk.nashorn.internal.codegen.types.Type
的用法示例。
在下文中一共展示了Type.getMethodDescriptor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDynamicSignature
import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
/**
* Helper function to generate a function signature based on stack contents
* and argument count and return type
*
* @param returnType return type
* @param argCount argument count
*
* @return function signature for stack contents
*/
private String getDynamicSignature(final Type returnType, final int argCount) {
final Type[] paramTypes = new Type[argCount];
int pos = 0;
for (int i = argCount - 1; i >= 0; i--) {
Type pt = stack.peek(pos++);
// "erase" specific ScriptObject subtype info - except for NativeArray.
// NativeArray is used for array/List/Deque conversion for Java calls.
if (ScriptObject.class.isAssignableFrom(pt.getTypeClass()) &&
!NativeArray.class.isAssignableFrom(pt.getTypeClass())) {
pt = Type.SCRIPT_OBJECT;
}
paramTypes[i] = pt;
}
final String descriptor = Type.getMethodDescriptor(returnType, paramTypes);
for (int i = 0; i < argCount; i++) {
popType(paramTypes[argCount - i - 1]);
}
return descriptor;
}
示例2: getStaticSignature
import jdk.nashorn.internal.codegen.types.Type; //导入方法依赖的package包/类
private String getStaticSignature() {
if (staticSignature == null) {
if (paramTypes == null) {
staticSignature = Type.getMethodDescriptor(returnType, Type.typeFor(ScriptObject.class), Type.INT);
} else {
final Type[] params = new Type[paramTypes.length + 2];
params[0] = Type.typeFor(ScriptObject.class);
params[1] = Type.INT;
System.arraycopy(paramTypes, 0, params, 2, paramTypes.length);
staticSignature = Type.getMethodDescriptor(returnType, params);
}
}
return staticSignature;
}