当前位置: 首页>>代码示例>>Java>>正文


Java ReferenceType.signature方法代码示例

本文整理汇总了Java中com.sun.jdi.ReferenceType.signature方法的典型用法代码示例。如果您正苦于以下问题:Java ReferenceType.signature方法的具体用法?Java ReferenceType.signature怎么用?Java ReferenceType.signature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sun.jdi.ReferenceType的用法示例。


在下文中一共展示了ReferenceType.signature方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validateAssignment

import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
void validateAssignment(ValueContainer destination)
                        throws InvalidTypeException, ClassNotLoadedException {

    /*
     * Do these simpler checks before attempting a query of the destination's
     * type which might cause a confusing ClassNotLoadedException if
     * the destination is primitive or an array.
     */
    /*
     * TO DO: Centralize JNI signature knowledge
     */
    if (destination.signature().length() == 1) {
        throw new InvalidTypeException("Can't assign object value to primitive");
    }
    if ((destination.signature().charAt(0) == '[') &&
        (type().signature().charAt(0) != '[')) {
        throw new InvalidTypeException("Can't assign non-array value to an array");
    }
    if ("void".equals(destination.typeName())) {
        throw new InvalidTypeException("Can't assign object value to a void");
    }

    // Validate assignment
    ReferenceType destType = (ReferenceTypeImpl)destination.type();
    ReferenceTypeImpl myType = (ReferenceTypeImpl)referenceType();
    if (!myType.isAssignableTo(destType)) {
        JNITypeParser parser = new JNITypeParser(destType.signature());
        String destTypeName = parser.typeName();
        throw new InvalidTypeException("Can't assign " +
                                       type().name() +
                                       " to " + destTypeName);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:ObjectReferenceImpl.java

示例2: getGenericName

import com.sun.jdi.ReferenceType; //导入方法依赖的package包/类
private String getGenericName(ReferenceType type) throws DebugException {
    if (type instanceof ArrayType) {
        try {
            Type componentType;
            componentType = ((ArrayType) type).componentType();
            if (componentType instanceof ReferenceType) {
                return getGenericName((ReferenceType) componentType) + "[]"; //$NON-NLS-1$
            }
            return type.name();
        } catch (ClassNotLoadedException e) {
            // we cannot create the generic name using the component type,
            // just try to create one with the information
        }
    }
    String signature = type.signature();
    StringBuffer res = new StringBuffer(getTypeName(signature));
    String genericSignature = type.genericSignature();
    if (genericSignature != null) {
        String[] typeParameters = Signature.getTypeParameters(genericSignature);
        if (typeParameters.length > 0) {
            res.append('<').append(Signature.getTypeVariable(typeParameters[0]));
            for (int i = 1; i < typeParameters.length; i++) {
                res.append(',').append(Signature.getTypeVariable(typeParameters[i]));
            }
            res.append('>');
        }
    }
    return res.toString();
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:30,代码来源:JavaHotCodeReplaceProvider.java


注:本文中的com.sun.jdi.ReferenceType.signature方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。