• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ArrayType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.sun.jdi.ArrayType的典型用法代码示例。如果您正苦于以下问题:Java ArrayType类的具体用法?Java ArrayType怎么用?Java ArrayType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ArrayType类属于com.sun.jdi包,在下文中一共展示了ArrayType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: test2

import com.sun.jdi.ArrayType; //导入依赖的package包/类
@SuppressWarnings("unused") // called via reflection
private void test2() throws Exception {
    System.out.println("DEBUG: ------------> Running test2");
    try {
        Field field = targetClass.fieldByName("byteArray");
        ArrayType arrType = (ArrayType)field.type();

        for (int i = 0; i < 15; i++) {
            ArrayReference byteArrayVal = arrType.newInstance(3000000);
            if (byteArrayVal.isCollected()) {
                System.out.println("DEBUG: Object got GC'ed before we can use it. NO-OP.");
                continue;
            }
            invoke("testPrimitive", "([B)V", byteArrayVal);
        }
    } catch (VMOutOfMemoryException e) {
        defaultHandleOOMFailure(e);
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:OomDebugTest.java


示例2: getArrayClass

import com.sun.jdi.ArrayType; //导入依赖的package包/类
static ArrayType getArrayClass(VirtualMachine vm, String name) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper {
    List<ReferenceType> classList = VirtualMachineWrapper.classesByName(vm, name);
    ReferenceType clazz = null;
    for (ReferenceType c : classList) {
        if (ReferenceTypeWrapper.classLoader(c) == null) {
            clazz = c;
            break;
        }
    }
    return (ArrayType) clazz;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:RemoteServices.java


示例3: createTranslation

import com.sun.jdi.ArrayType; //导入依赖的package包/类
/**
 * Creates a new translated node for given original one.
 *
 * @param o a node to be translated
 * @return a new translated node
 */
private Object createTranslation (Object o) {
    switch (translationID) {
        case THREAD_ID:
            if (o instanceof ThreadReference) {
                return new JPDAThreadImpl ((ThreadReference) o, debugger);
            } else if (o instanceof ThreadGroupReference) {
                return new JPDAThreadGroupImpl ((ThreadGroupReference) o, debugger);
            } else {
                return null;
            }
        case LOCALS_ID:
            if (o instanceof ArrayType) {
                return new JPDAArrayTypeImpl(debugger, (ArrayType) o);
            }
            if (o instanceof ReferenceType) {
                return new JPDAClassTypeImpl(debugger, (ReferenceType) o);
            }
        default:
            throw new IllegalStateException(""+o);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ObjectTranslation.java


示例4: getArrayType

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private ArrayType getArrayType(NewArrayTree arg0, Type type, int depth, EvaluationContext evaluationContext) {
    String arrayClassName;
    if (depth < BRACKETS.length()/2) {
        arrayClassName = type.name() + BRACKETS.substring(0, 2*depth);
    } else {
        arrayClassName = type.name() + BRACKETS;
        for (int i = BRACKETS.length()/2; i < depth; i++) {
            arrayClassName += "[]"; // NOI18N
        }
    }
    ReferenceType rt = getOrLoadClass(type.virtualMachine(), arrayClassName, evaluationContext);
    if (rt == null) {
        Assert.error(arg0, "unknownType", arrayClassName);
    }
    return (ArrayType) rt;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:EvaluatorVisitor.java


示例5: isAssignableTo

import com.sun.jdi.ArrayType; //导入依赖的package包/类
boolean isAssignableTo(ReferenceType destType) {
    if (destType instanceof ArrayType) {
        try {
            Type destComponentType = ((ArrayType)destType).componentType();
            return isComponentAssignable(destComponentType, componentType());
        } catch (ClassNotLoadedException e) {
            // One or both component types has not yet been
            // loaded => can't assign
            return false;
        }
    } else if (destType instanceof InterfaceType) {
        // Only valid InterfaceType assignee is Cloneable
        return destType.name().equals("java.lang.Cloneable");
    } else {
        // Only valid ClassType assignee is Object
        return destType.name().equals("java.lang.Object");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ArrayTypeImpl.java


示例6: handleSetValueForObject

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private Value handleSetValueForObject(String name, String belongToClass, String valueString,
        ObjectReference container, Map<String, Object> options) throws InvalidTypeException, ClassNotLoadedException {
    Value newValue;
    if (container instanceof ArrayReference) {
        ArrayReference array = (ArrayReference) container;
        Type eleType = ((ArrayType) array.referenceType()).componentType();
        newValue = setArrayValue(array, eleType, Integer.parseInt(name), valueString, options);
    } else {
        if (StringUtils.isBlank(belongToClass)) {
            Field field = container.referenceType().fieldByName(name);
            if (field != null) {
                if (field.isStatic()) {
                    newValue = this.setStaticFieldValue(container.referenceType(), field, name, valueString, options);
                } else {
                    newValue = this.setObjectFieldValue(container, field, name, valueString, options);
                }
            } else {
                throw new IllegalArgumentException(
                        String.format("SetVariableRequest: Variable %s cannot be found.", name));
            }
        } else {
            newValue = setFieldValueWithConflict(container, container.referenceType().allFields(), name, belongToClass, valueString, options);
        }
    }
    return newValue;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:27,代码来源:SetVariableRequestHandler.java


示例7: hasChildren

import com.sun.jdi.ArrayType; //导入依赖的package包/类
/**
 * Test whether the value has referenced objects.
 *
 * @param value
 *            the value.
 * @param includeStatic
 *            whether or not the static fields are visible.
 * @return true if this value is reference objects.
 */
public static boolean hasChildren(Value value, boolean includeStatic) {
    if (value == null) {
        return false;
    }
    Type type = value.type();
    if (type instanceof ArrayType) {
        return ((ArrayReference) value).length() > 0;
    }
    return value.type() instanceof ReferenceType && ((ReferenceType) type).allFields().stream()
            .filter(t -> includeStatic || !t.isStatic()).toArray().length > 0;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:21,代码来源:VariableUtils.java


示例8: isAssignableTo

import com.sun.jdi.ArrayType; //导入依赖的package包/类
boolean isAssignableTo(ReferenceType destType) {
    if (destType instanceof ArrayType) {
        try {
            Type destComponentType = ((ArrayType)destType).componentType();
            return isComponentAssignable(destComponentType, componentType());
        } catch (ClassNotLoadedException e) {
            // One or both component types has not yet been
            // loaded => can't assign
            return false;
        }
    } else {
        Symbol typeName = ((ReferenceTypeImpl)destType).typeNameAsSymbol();
        if (destType instanceof InterfaceType) {
            // Every array type implements java.io.Serializable and
            // java.lang.Cloneable. fixme in JVMDI-JDI, includes only
            // Cloneable but not Serializable.
            return typeName.equals(vm.javaLangCloneable()) ||
                   typeName.equals(vm.javaIoSerializable());
        } else {
            // Only valid ClassType assignee is Object
            return typeName.equals(vm.javaLangObject());
        }
    }
}
 
开发者ID:campolake,项目名称:openjdk9,代码行数:25,代码来源:ArrayTypeImpl.java


示例9: visitArrayCells

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private boolean visitArrayCells(final Location location, final StackFrame frame,
    final ArrayReference arrayRef)
{
  // only process small arrays
  if (!manager().generateArrayEvents() || arrayRef == null
      || arrayRef.length() > EventFactoryAdapter.SMALL_ARRAY_SIZE)
  {
    return false;
  }
  // retrieve the array reference type
  final ArrayType at = (ArrayType) arrayRef.type();
  // retrieve the array contour
  final IContextContour array = contourFactory().lookupInstanceContour(at.name(),
      arrayRef.uniqueID());
  // make sure the respective array contour exists
  if (array == null)
  {
    return false;
  }
  return visitArrayCells(location, frame, arrayRef, array);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:22,代码来源:JDIEventHandlerDelegate.java


示例10: jdiTypeLoadArray

import com.sun.jdi.ArrayType; //导入依赖的package包/类
public void jdiTypeLoadArray(final ArrayType type)
{
  try
  {
    final Type componentType = type.componentType();
    if (componentType instanceof ReferenceType)
    {
      jdiTypeLoad(((ReferenceType) componentType));
    }
  }
  catch (final ClassNotLoadedException e)
  {
    System.err.println("Error: type not loaded for array '" + type.signature() + "'");
    //
    String componentTypeName = type.signature();
    componentTypeName = componentTypeName.substring(componentTypeName.lastIndexOf('[') + 1);
    //
    registry.getTypeId(componentTypeName);
  }
  jdiTypeLoadComplete(type);
}
 
开发者ID:UBPL,项目名称:jive,代码行数:22,代码来源:EventHandlerLite.java


示例11: createTargetBytes

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private static ArrayReference createTargetBytes(VirtualMachine vm, byte[] bytes,
                                                ByteValue[] mirrorBytesCache) throws InvalidTypeException,
                                                                                     ClassNotLoadedException,
                                                                                     InternalExceptionWrapper,
                                                                                     VMDisconnectedExceptionWrapper,
                                                                                     ObjectCollectedExceptionWrapper,
                                                                                     UnsupportedOperationExceptionWrapper {
    ArrayType bytesArrayClass = getArrayClass(vm, "byte[]");
    ArrayReference array = null;
    boolean disabledCollection = false;
    while (!disabledCollection) {
        array = ArrayTypeWrapper.newInstance(bytesArrayClass, bytes.length);
        try {
            ObjectReferenceWrapper.disableCollection(array);
            disabledCollection = true;
        } catch (ObjectCollectedExceptionWrapper ocex) {
            // Collected too soon, try again...
        }
    }
    List<Value> values = new ArrayList<Value>(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
        byte b = bytes[i];
        ByteValue mb = mirrorBytesCache[128 + b];
        if (mb == null) {
            mb = VirtualMachineWrapper.mirrorOf(vm, b);
            mirrorBytesCache[128 + b] = mb;
        }
        values.add(mb);
    }
    ArrayReferenceWrapper.setValues(array, values);
    return array;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:RemoteServices.java


示例12: JPDAArrayTypeImpl

import com.sun.jdi.ArrayType; //导入依赖的package包/类
public JPDAArrayTypeImpl(JPDADebuggerImpl debugger, ArrayType arrayType) {
    super(debugger, arrayType);
    this.arrayType = arrayType;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:JPDAArrayTypeImpl.java


示例13: getArrayClass

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private static ArrayType getArrayClass(VirtualMachine vm, String name) throws InternalExceptionWrapper,
                                                                              ObjectCollectedExceptionWrapper,
                                                                              VMDisconnectedExceptionWrapper {
    List<ReferenceType> classList = VirtualMachineWrapper.classesByName(vm, name);
    ReferenceType clazz = null;
    for (ReferenceType c : classList) {
        if (ReferenceTypeWrapper.classLoader(c) == null) {
            clazz = c;
            break;
        }
    }
    return (ArrayType) clazz;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:RemoteServices.java


示例14: createTargetBytes

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private static ArrayReference createTargetBytes(VirtualMachine vm, byte[] bytes,
                                                ByteValue[] mirrorBytesCache) throws InvalidTypeException,
                                                                                     ClassNotLoadedException,
                                                                                     InternalExceptionWrapper,
                                                                                     VMDisconnectedExceptionWrapper,
                                                                                     ObjectCollectedExceptionWrapper {
    ArrayType bytesArrayClass = getArrayClass(vm, "byte[]");
    ArrayReference array = null;
    boolean disabledCollection = false;
    while (!disabledCollection) {
        array = ArrayTypeWrapper.newInstance(bytesArrayClass, bytes.length);
        try {
            ObjectReferenceWrapper.disableCollection(array);
            disabledCollection = true;
        } catch (ObjectCollectedExceptionWrapper ocex) {
            // Collected too soon, try again...
        } catch (UnsupportedOperationExceptionWrapper uex) {
            // Hope it will not be GC'ed...
            disabledCollection = true;
        }
    }
    List<Value> values = new ArrayList<Value>(bytes.length);
    for (int i = 0; i < bytes.length; i++) {
        byte b = bytes[i];
        ByteValue mb = mirrorBytesCache[128 + b];
        if (mb == null) {
            mb = VirtualMachineWrapper.mirrorOf(vm, b);
            mirrorBytesCache[128 + b] = mb;
        }
        values.add(mb);
    }
    ArrayReferenceWrapper.setValues(array, values);
    return array;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:RemoteServices.java


示例15: getTypeName

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private static String getTypeName(TypeMirror type) {
    if (type.getKind() == TypeKind.ARRAY) {
        return getTypeName(((javax.lang.model.type.ArrayType) type).getComponentType())+"[]";
    }
    if (type.getKind() == TypeKind.TYPEVAR) {
        TypeVariable tv = (TypeVariable) type;
        return getTypeName(tv.getUpperBound());
    }
    if (type.getKind() == TypeKind.DECLARED) {
        return ElementUtilities.getBinaryName((TypeElement) ((DeclaredType) type).asElement());
    }
    return type.toString();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:EvaluatorVisitor.java


示例16: createArrayMirrorWithDisabledCollection

import com.sun.jdi.ArrayType; //导入依赖的package包/类
private static ArrayReference createArrayMirrorWithDisabledCollection(ArrayType arrayType, int dimension, EvaluationContext evaluationContext) {
    ArrayReference array;
    do {
        array = arrayType.newInstance(dimension);
        try {
            evaluationContext.disableCollectionOf(array);
        } catch (ObjectCollectedException oce) {
            array = null; // Already collected! Create a new value and try again...
        }
    } while (array == null);
    return array;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:EvaluatorVisitor.java


示例17: newInstance

import com.sun.jdi.ArrayType; //导入依赖的package包/类
public ArrayReference newInstance(int length) {
    try {
        return (ArrayReference)JDWP.ArrayType.NewInstance.
                                   process(vm, this, length).newArray;
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:ArrayTypeImpl.java


示例18: listFieldVariables

import com.sun.jdi.ArrayType; //导入依赖的package包/类
/**
 * Get the variables of the object.
 *
 * @param obj
 *            the object
 * @return the variable list
 * @throws AbsentInformationException
 *             when there is any error in retrieving information
 */
public static List<Variable> listFieldVariables(ObjectReference obj, boolean includeStatic) throws AbsentInformationException {
    List<Variable> res = new ArrayList<>();
    Type type = obj.type();
    if (type instanceof ArrayType) {
        int arrayIndex = 0;
        for (Value elementValue : ((ArrayReference) obj).getValues()) {
            Variable ele = new Variable(String.valueOf(arrayIndex++), elementValue);
            res.add(ele);
        }
        return res;
    }
    List<Field> fields = obj.referenceType().allFields().stream().filter(t -> includeStatic || !t.isStatic())
            .sorted((a, b) -> {
                try {
                    boolean v1isStatic = a.isStatic();
                    boolean v2isStatic = b.isStatic();
                    if (v1isStatic && !v2isStatic) {
                        return -1;
                    }
                    if (!v1isStatic && v2isStatic) {
                        return 1;
                    }
                    return a.name().compareToIgnoreCase(b.name());
                } catch (Exception e) {
                    logger.log(Level.SEVERE, String.format("Cannot sort fields: %s", e), e);
                    return -1;
                }
            }).collect(Collectors.toList());
    fields.forEach(f -> {
        Variable var = new Variable(f.name(), obj.getValue(f));
        var.field = f;
        res.add(var);
    });
    return res;
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:45,代码来源:VariableUtils.java


示例19: getGenericName

import com.sun.jdi.ArrayType; //导入依赖的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


示例20: isApplicable

import com.sun.jdi.ArrayType; //导入依赖的package包/类
public boolean isApplicable(Type type) {
  return (type instanceof ArrayType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ArrayRenderer.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BigFraction类代码示例发布时间:2022-05-22
下一篇:
Java ColoringAttributes类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap