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


Java LocalVariable类代码示例

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


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

示例1: testAcceptType

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
@Test
public void testAcceptType() throws Exception {
    ObjectReference foo = this.getObjectReference("Foo");

    assertFalse("Should not accept null type.", formatter.acceptType(null, new HashMap<>()));

    assertFalse("Should not accept Foo type.", formatter.acceptType(foo.referenceType(), new HashMap<>()));

    ObjectReference str = this.getObjectReference("java.lang.String");
    assertFalse("Should not accept String type.", formatter.acceptType(str.referenceType(), new HashMap<>()));

    ObjectReference clz = this.getObjectReference("java.lang.Class");
    assertFalse("Should not accept Class type.", formatter.acceptType(clz.referenceType(), new HashMap<>()));

    LocalVariable list = this.getLocalVariable("strList");
    assertFalse("Should not accept List type.", formatter.acceptType(list.type(), new HashMap<>()));

    LocalVariable arrays = this.getLocalVariable("arrays");
    assertTrue("Should accept array type.", formatter.acceptType(arrays.type(), new HashMap<>()));
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:21,代码来源:ArrayObjectFormatterTest.java

示例2: createTranslation

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
private Object createTranslation (Object o, Object v) {
    switch (translationID) {
        case LOCALS_ID:
            if (o instanceof LocalVariable && (v == null || v instanceof Value)) {
                LocalVariable lv = (LocalVariable) o;
                org.netbeans.api.debugger.jpda.LocalVariable local;
                if (v instanceof ObjectReference || v == null) {
                    local = new ObjectLocalVariable (
                        debugger, 
                        (ObjectReference) v, 
                        null, 
                        lv, 
                        JPDADebuggerImpl.getGenericSignature (lv), 
                        null
                    );
                } else {
                    local = new Local (debugger, (PrimitiveValue) v, null, lv, null);
                }
                return local;
            }
        default:
            throw new IllegalStateException(""+o);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ObjectTranslation.java

示例3: ObjectLocalVariable

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
private ObjectLocalVariable (
    JPDADebuggerImpl debugger,
    ObjectReference value,
    String className, 
    LocalVariable local, 
    String genericSignature,
    String id,
    CallStackFrameImpl frame
) {
    super (debugger, 
        value, 
        genericSignature, 
        id);
    this.local = local;
    if (frame != null) {
        this.thread = frame.getThread();
        this.depth = frame.getFrameDepth();
    }
    this.className = className;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:ObjectLocalVariable.java

示例4: Local

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
Local (
    JPDADebuggerImpl debugger,
    PrimitiveValue value, 
    String className,
    LocalVariable local,
    CallStackFrameImpl frame
) {
    super (
        debugger, 
        value, 
        getID(local, value)
    );
    this.local = local;
    if (frame != null) {
        this.thread = frame.getThread();
        this.depth = frame.getFrameDepth();
    }
    this.className = className;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Local.java

示例5: createVisibleVariables

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
/**
 * Build the visible variable map.
 * Need not be synchronized since it cannot be provably stale.
 */
private void createVisibleVariables() throws AbsentInformationException {
    if (visibleVariables == null) {
        List<LocalVariable> allVariables = location.method().variables();
        Map<String, LocalVariable> map = new HashMap<>(allVariables.size());

        for (LocalVariable variable : allVariables) {
            String name = variable.name();
            if (variable.isVisible(this)) {
                LocalVariable existing = map.get(name);
                if ((existing == null) ||
                    ((LocalVariableImpl)variable).hides(existing)) {
                    map.put(name, variable);
                }
            }
        }
        visibleVariables = map;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:StackFrameImpl.java

示例6: testAcceptType

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
@Test
public void testAcceptType() throws Exception {
    LocalVariable i = this.getLocalVariable("i");

    assertFalse("NumericFormatter should accept null.", formatter.acceptType(null, new HashMap<>()));
    assertTrue("NumericFormatter should accept int type.", formatter.acceptType(i.type(), new HashMap<>()));
    ObjectReference integer = this.getObjectReference("java.lang.Integer");
    assertFalse("NumericFormatter should not accept Integer type.", formatter.acceptType(integer.type(), new HashMap<>()));
    assertFalse("NumericFormatter should not accept Object type.", formatter.acceptType(this.getLocalVariable("obj").type(), new HashMap<>()));
    assertFalse("NumericFormatter should not accept array type.", formatter.acceptType(this.getLocalVariable("arrays").type(), new HashMap<>()));
    assertFalse("NumericFormatter should not accept String type.", formatter.acceptType(this.getLocalVariable("str").type(), new HashMap<>()));

    VirtualMachine vm = getVM();
    assertFalse("NumericFormatter should not accept boolean type.",
        formatter.acceptType(vm.mirrorOf(true).type(), new HashMap<>()));

    assertFalse("NumericFormatter should not accept char type.",
        formatter.acceptType(vm.mirrorOf('c').type(), new HashMap<>()));

    assertTrue("NumericFormatter should accept long type.",
        formatter.acceptType(vm.mirrorOf(1L).type(), new HashMap<>()));

    assertTrue("NumericFormatter should accept float type.",
        formatter.acceptType(vm.mirrorOf(1.2f).type(), new HashMap<>()));

    assertTrue("NumericFormatter should accept double type.",
        formatter.acceptType(vm.mirrorOf(1.2).type(), new HashMap<>()));

    assertTrue("NumericFormatter should accept byte type.",
        formatter.acceptType(vm.mirrorOf((byte)12).type(), new HashMap<>()));

    assertTrue("NumericFormatter should accept short type.",
        formatter.acceptType(vm.mirrorOf((short)12121).type(), new HashMap<>()));
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:35,代码来源:NumericFormatterTest.java

示例7: testAcceptType

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
@Test
public void testAcceptType() throws Exception {
    ObjectReference foo = this.getObjectReference("Foo");

    assertTrue("Should accept null type.", formatter.acceptType(null, new HashMap<>()));

    assertFalse("Should not accept Foo type.", formatter.acceptType(foo.referenceType(), new HashMap<>()));

    ObjectReference str = this.getObjectReference("java.lang.String");
    assertFalse("Should not accept String type.", formatter.acceptType(str.referenceType(), new HashMap<>()));

    ObjectReference clz = this.getObjectReference("java.lang.Class");
    assertFalse("Should not accept Class type.", formatter.acceptType(clz.referenceType(), new HashMap<>()));

    LocalVariable list = this.getLocalVariable("strList");
    assertFalse("Should not accept List type.", formatter.acceptType(list.type(), new HashMap<>()));

    LocalVariable arrays = this.getLocalVariable("arrays");
    assertFalse("Should not accept array type.", formatter.acceptType(arrays.type(), new HashMap<>()));
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:21,代码来源:NullObjectFormatterTest.java

示例8: testAcceptType

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
@Test
public void testAcceptType() throws Exception {
    ObjectReference foo = this.getObjectReference("Foo");

    assertFalse("Should not accept null type.", formatter.acceptType(null, new HashMap<>()));

    assertFalse("Should not accept Foo type.", formatter.acceptType(foo.referenceType(), new HashMap<>()));

    ObjectReference str = this.getObjectReference("java.lang.String");
    assertFalse("Should not accept String type.", formatter.acceptType(str.referenceType(), new HashMap<>()));

    ObjectReference clz = this.getObjectReference("java.lang.Class");
    assertTrue("Should accept Class type.", formatter.acceptType(clz.referenceType(), new HashMap<>()));

    LocalVariable list = this.getLocalVariable("strList");
    assertFalse("Should not accept List type.", formatter.acceptType(list.type(), new HashMap<>()));

    LocalVariable arrays = this.getLocalVariable("arrays");
    assertFalse("Should not accept array type.", formatter.acceptType(arrays.type(), new HashMap<>()));
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:21,代码来源:ClassObjectFormatterTest.java

示例9: testAcceptType

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
@Test
public void testAcceptType() throws Exception {
    ObjectReference or = this.getObjectReference("Foo");

    assertFalse("Should not accept null type.", formatter.acceptType(null, new HashMap<>()));

    assertTrue("Should accept Foo type.", formatter.acceptType(or.referenceType(), new HashMap<>()));

    ObjectReference str = this.getObjectReference("java.lang.String");
    assertTrue("Should accept String type.", formatter.acceptType(str.referenceType(), new HashMap<>()));

    ObjectReference clz = this.getObjectReference("java.lang.Class");
    assertTrue("Should accept Class type.", formatter.acceptType(clz.referenceType(), new HashMap<>()));

    LocalVariable list = this.getLocalVariable("strList");
    assertTrue("Should accept List type.", formatter.acceptType(list.type(), new HashMap<>()));

    LocalVariable arrays = this.getLocalVariable("arrays");
    assertTrue("Should accept array type.", formatter.acceptType(arrays.type(), new HashMap<>()));
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:21,代码来源:ObjectFormatterTest.java

示例10: testAcceptType

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
@Test
public void testAcceptType() throws Exception {
    ObjectReference foo = this.getObjectReference("Foo");

    assertFalse("Should not accept null type.", formatter.acceptType(null, new HashMap<>()));

    assertFalse("Should not accept Foo type.", formatter.acceptType(foo.referenceType(), new HashMap<>()));

    ObjectReference str = this.getObjectReference("java.lang.String");
    assertTrue("Should accept String type.", formatter.acceptType(str.referenceType(), new HashMap<>()));

    ObjectReference clz = this.getObjectReference("java.lang.Class");
    assertFalse("Should not accept Class type.", formatter.acceptType(clz.referenceType(), new HashMap<>()));

    LocalVariable list = this.getLocalVariable("strList");
    assertFalse("Should not accept List type.", formatter.acceptType(list.type(), new HashMap<>()));

    LocalVariable arrays = this.getLocalVariable("arrays");
    assertFalse("Should not accept array type.", formatter.acceptType(arrays.type(), new HashMap<>()));
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:21,代码来源:StringObjectFormatterTest.java

示例11: getValues

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
public Map<LocalVariable, Value> getValues(List<? extends LocalVariable> vars) {
    Map<LocalVariable, LocalVariable> fieldMap = new HashMap<LocalVariable, LocalVariable>();
    List<LocalVariable> unwrappedLocalVariables = new ArrayList<LocalVariable>();
    for (LocalVariable var : vars) {
        LocalVariable unwrapped = F3Wrapper.unwrap(var);
        if (isF3SyntheticLocalVar(unwrapped.name())) {
            throw new IllegalArgumentException("invalid var: " + var.name());
        }
        unwrappedLocalVariables.add(unwrapped);
        fieldMap.put(unwrapped, var);
    }
    Map<LocalVariable, Value> fieldValues = underlying().getValues(unwrappedLocalVariables);
    Map<LocalVariable, Value> result = new HashMap<LocalVariable, Value>();
    for (Map.Entry<LocalVariable, Value> entry: fieldValues.entrySet()) {
        result.put(fieldMap.get(entry.getKey()), entry.getValue());
    }
    return result;
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:19,代码来源:F3StackFrame.java

示例12: testHello1

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
@Test(timeout=5000)
public void testHello1() {
    try {
        compile("LocalVar.f3");
        stop("in LocalVar.f3$run$");

        f3run();

        BreakpointEvent bkpt = resumeToBreakpoint();
        // We hide F3 synthetic variables.
        F3StackFrame frame = (F3StackFrame) bkpt.thread().frame(0);
        LocalVariable var = frame.visibleVariableByName("_$UNUSED$_$ARGS$_");
        Assert.assertNull(var);

        // underlying (java) frame object exposes this variable.
        StackFrame jframe = F3Wrapper.unwrap(frame);
        var = jframe.visibleVariableByName("_$UNUSED$_$ARGS$_");
        Assert.assertNotNull(var);

        resumeToVMDeath();
        quit();
    } catch (Exception exp) {
        exp.printStackTrace();
        Assert.fail(exp.getMessage());
    }
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:27,代码来源:LocalVarTest.java

示例13: createVariable

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
private void createVariable(final LocalVariable var, final int lineFrom, final int lineTo,
    final IMethodNode methodNode)
{
  ITypeNodeRef varTypeNode;
  try
  {
    varTypeNode = upstream.resolveType(var.type().signature(), var.typeName());
  }
  catch (final ClassNotLoadedException e)
  {
    varTypeNode = modelFactory().lookupTypeRefByName(var.typeName());
  }
  methodNode.addDataMember(var.name(), lineFrom, lineTo, varTypeNode, NO_JDI,
      createModifiers(var), NodeVisibility.NV_LOCAL, model.valueFactory()
          .createUninitializedValue());
}
 
开发者ID:UBPL,项目名称:jive,代码行数:17,代码来源:StaticModelDelegateForJDI.java

示例14: getMethodId

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
public Long getMethodId(final Method method)
{
  final String sig = Signatures.getPrefixed(method);
  Long id = store.get(sig);
  if (id != null)
  {
    return id;
  }
  id = register(Signatures.PREFIX_METHOD, sig, METHOD_ID.incrementAndGet());
  try
  {
    if (method != null)
    {
      for (final LocalVariable v : method.variables())
      {
        getVariableId(v);
      }
    }
  }
  catch (final AbsentInformationException ignored)
  {
  }
  return id;
}
 
开发者ID:UBPL,项目名称:jive,代码行数:25,代码来源:EventHandlerLite.java

示例15: compareTo

import com.sun.jdi.LocalVariable; //导入依赖的package包/类
public int compareTo(LocalVariable object) {
    LocalVariableImpl other = (LocalVariableImpl)object;

    int rc = scopeStart.compareTo(other.scopeStart);
    if (rc == 0) {
        rc = slot() - other.slot();
    }
    return rc;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:LocalVariableImpl.java


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