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


Java ArrayType类代码示例

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


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


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