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


Java ArrayReference类代码示例

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


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

示例1: test2

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

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
boolean handleNewArray(final ArrayReference array, final Location location, final StackFrame frame)
{
  if (array == null || !manager().generateArrayEvents())
  {
    return false;
  }
  // handle the instantiation of of small arrays
  if (array != null && array.length() <= EventFactoryAdapter.SMALL_ARRAY_SIZE
      && contourFactory().lookupInstanceContour(array.type().name(), array.uniqueID()) == null)
  {
    handleTypeLoad((ReferenceType) array.type(), frame.thread());
    // a specialized new event handles the immutable length of the array
    manager().jiveDispatcher().dispatchNewEvent(array, frame.thread(), array.length());
    visitArrayCells(location, frame, array);
    return true;
  }
  return false;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:19,代码来源:JDIEventHandlerDelegate.java

示例3: ArrayFieldVariable

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
ArrayFieldVariable (
    JPDADebuggerImpl debugger,
    PrimitiveValue value,
    String declaredType,
    ObjectVariable array,
    int index,
    int maxIndex,
    String parentID
) {
    super (
        debugger, 
        value, 
        parentID + '.' + index +
            (value instanceof ObjectReference ? "^" : "")
    );
    this.index = index;
    this.maxIndexLog = log10(maxIndex);
    this.declaredType = declaredType;
    this.parent = array;
    this.array = (ArrayReference) ((JDIVariable) array).getJDIValue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:ArrayFieldVariable.java

示例4: ObjectArrayFieldVariable

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
ObjectArrayFieldVariable (
    JPDADebuggerImpl debugger,
    ObjectReference value,
    String declaredType,
    ObjectVariable array,
    int index,
    int maxIndex,
    String parentID
) {
    super (
        debugger, 
        value, 
        parentID + '.' + index + "^"
    );
    this.index = index;
    this.maxIndexLog = ArrayFieldVariable.log10(maxIndex);
    this.declaredType = declaredType;
    this.parent = array;
    this.array = (ArrayReference) ((JDIVariable) array).getJDIValue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ObjectArrayFieldVariable.java

示例5: getFieldsCount

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
/**
* Returns string representation of type of this variable.
*
* @return string representation of type of this variable.
*/
@Override
public int getFieldsCount () {
    Value v = getInnerValue ();
    if (v == null) {
        return 0;
    }
    if (v instanceof ArrayReference) {
        return ArrayReferenceWrapper.length0((ArrayReference) v);
    } else {
        synchronized (fieldsLock) {
            if (fields == null || refreshFields) {
                initFields ();
            }
            return fields.length;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:AbstractObjectVariable.java

示例6: visitArrayAccess

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
@Override
public Mirror visitArrayAccess(ArrayAccessTree arg0, EvaluationContext evaluationContext) {
    Mirror array = arg0.getExpression().accept(this, evaluationContext);
    if (array == null) {
        Assert.error(arg0, "arrayIsNull", arg0.getExpression());
    }
    Mirror index = arg0.getIndex().accept(this, evaluationContext);
    if (!(array instanceof ArrayReference)) {
        Assert.error(arg0, "notArrayType", arg0.getExpression());
    }
    if (!(index instanceof PrimitiveValue)) {
        Assert.error(arg0, "arraySizeBadType", index);
    }
    int i = ((PrimitiveValue) index).intValue();
    if (i < 0 || i >= ((ArrayReference) array).length()) {
        Assert.error(arg0, "arrayIndexOutOfBounds", array, i);
    }
    evaluationContext.putArrayAccess(arg0, (ArrayReference)array, i);
    return ((ArrayReference) array).getValue(i);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:EvaluatorVisitor.java

示例7: equals

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
@Override
public boolean equals(Object obj) {
    if (!(obj instanceof JDIValue)) return false;
    Value v = ((JDIValue) obj).value;
    if (value == null) return v == null;
    if (value instanceof StringReference) {
        if (!(v instanceof StringReference)) return false;
        return ((StringReference) value).value().equals(((StringReference) v).value());
    }
    if (value instanceof ArrayReference) {
        if (!(v instanceof ArrayReference)) return false;
        ArrayReference a1 = (ArrayReference) value;
        ArrayReference a2 = (ArrayReference) v;
        if (!a1.type().equals(a2.type())) return false;
        if (a1.length() != a2.length()) return false;
        int n = a1.length();
        for (int i = 0; i < n; i++) {
            if (!new JDIValue(a1.getValue(i)).equals(new JDIValue(a2.getValue(i)))) {
                return false;
            }
        }
        return true;
    }
    return value.equals(v);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:EvaluatorTest.java

示例8: getValues

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
public List<Value> getValues(int index, int length) {
    if (length == -1) { // -1 means the rest of the array
       length = length() - index;
    }
    validateArrayAccess(index, length);
    if (length == 0) {
        return new ArrayList<Value>();
    }

    List<Value> vals;
    try {
        vals = cast(JDWP.ArrayReference.GetValues.process(vm, this, index, length).values);
    } catch (JDWPException exc) {
        throw exc.toJDIException();
    }

    return vals;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:19,代码来源:ArrayReferenceImpl.java

示例9: handleSetValueForObject

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

示例10: hasChildren

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

示例11: checkConditions

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
private void checkConditions(ThreadReference threadRef, Field contextField) throws Exception {
  ArrayReference contextArray = getContextArray(contextField, threadRef);
  int size = contextArray.getValues().size();

  for (int i = 0; i < size; i++) {
    ObjectReference context = (ObjectReference) contextArray.getValues().get(i);
    if (context != null
        && (hasBundlePerms(context)
            || hasBundleProtectionDomain(context)
            || hasBlueprintProtectionDomain(context))) {
      missingPerms.put(getBundleLocation(context), getPermissionString(threadRef));
    }
  }

  if (missingPerms.isEmpty()) {
    System.out.println("this is wrong");
  }
}
 
开发者ID:coyotesqrl,项目名称:acdebugger,代码行数:19,代码来源:BreakpointProcessor.java

示例12: getBundleLocation

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
private String getBundleLocation(ObjectReference permissions) {
  List<String> walker;
  if (hasBundlePerms(permissions)) {
    walker = BUNDLE_PERM_WALKER;
  } else if (hasBlueprintProtectionDomain(permissions)) {
    walker = BLUEPRINT_PERM_WALKER;
  } else {
    walker = BUNDLE_PROTDOMAIN_WALKER;
  }

  ObjectReference revList = getReference(permissions, walker);
  ArrayReference revArray =
      (ArrayReference) revList.getValue(revList.referenceType().fieldByName("elementData"));
  ObjectReference moduleRev = (ObjectReference) revArray.getValue(0);
  return getValue(
      moduleRev,
      ImmutableList.of("symbolicName"),
      currRef -> ((StringReference) currRef).value());
}
 
开发者ID:coyotesqrl,项目名称:acdebugger,代码行数:20,代码来源:BreakpointProcessor.java

示例13: getVariables

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
@Override
public List<Variable> getVariables() {
  if (variables.get() == null) {
    synchronized (variables) {
      if (variables.get() == null) {
        if (isPrimitive()) {
          variables.set(Collections.emptyList());
        } else if (isArray()) {
          variables.set(new LinkedList<>());

          ArrayReference array = (ArrayReference) jdiValue;
          for (int i = 0; i < array.length(); i++) {
            variables.get().add(new JdbArrayElement(array.getValue(i), i, variablePath));
          }
        } else {
          ObjectReference object = (ObjectReference) jdiValue;
          variables.set(
              object
                  .referenceType()
                  .allFields()
                  .stream()
                  .map(f -> new JdbField(f, object, variablePath))
                  .sorted(new JdbFieldComparator())
                  .collect(Collectors.toList()));
        }
      }
    }
  }

  return variables.get();
}
 
开发者ID:eclipse,项目名称:che,代码行数:32,代码来源:JdbValue.java

示例14: wrap

import com.sun.jdi.ArrayReference; //导入依赖的package包/类
public static F3ObjectReference wrap(F3VirtualMachine f3vm, ObjectReference ref) {
    if (ref == null) {
        return null;
    } else if (ref instanceof ArrayReference) {
        return f3vm.arrayReference((ArrayReference)ref);
    } else if (ref instanceof StringReference) {
        return f3vm.stringReference((StringReference)ref);
    } else if (ref instanceof ThreadReference) {
        return f3vm.threadReference((ThreadReference)ref);
    } else if (ref instanceof ThreadGroupReference) {
        return f3vm.threadGroupReference((ThreadGroupReference)ref);
    } else if (ref instanceof ClassLoaderReference) {
        return f3vm.classLoaderReference((ClassLoaderReference)ref);
    } else if (ref instanceof ClassObjectReference) {
        return f3vm.classObjectReference((ClassObjectReference)ref);
    } else {
        return f3vm.objectReference(ref);
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:20,代码来源:F3Wrapper.java

示例15: visitArrayCells

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


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