请选择 进入手机版 | 继续访问电脑版
  • 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Mirror类代码示例

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

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



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

示例1: translate

import com.sun.jdi.Mirror; //导入依赖的package包/类
/**
 * Translates a debuggee Mirror to a wrapper object.
 *
 * @param o the Mirror object in the debuggee
 * @param v an additional argument used for the translation
 * @return translated object or <code>null</code> when the argument
 *         is not possible to translate.
 */
public Object translate (Mirror o, Object v) {
    Object r = null;
    boolean verify = false;
    synchronized (cache) {
        WeakReference wr = cache.get (o);
        if (wr != null)
            r = wr.get ();
        if (r == null) {
            r = createTranslation (o, v);
            cache.put (o, new WeakReference<Object>(r));
        } else {
            verify = true;
        }
    }
    if (verify) {
        verifyTranslation(r, o, v);
    }
    return r;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:ObjectTranslation.java


示例2: translateOnThread

import com.sun.jdi.Mirror; //导入依赖的package包/类
/**
 * Translates a debuggee Mirror to a thread-specific wrapper object.
 *
 * @param thread the thread on which the object lives
 * @param o the Mirror object in the debuggee
 * @param v an additional argument used for the translation
 * @return translated object or <code>null</code> when the argument
 *         is not possible to translate.
 */
public Object translateOnThread (JPDAThread thread, Mirror o, Object v) {
    Object r = null;
    boolean verify = false;
    synchronized (threadCache) {
        Map<Mirror, WeakReference<Object>> cache = threadCache.get(thread);
        if (cache == null) {
            cache = new WeakHashMap<>();
            threadCache.put(thread, cache);
        }
        WeakReference wr = cache.get (o);
        if (wr != null)
            r = wr.get ();
        if (r == null) {
            r = createTranslation (o, v);
            cache.put (o, new WeakReference<Object>(r));
        } else {
            verify = true;
        }
    }
    if (verify) {
        verifyTranslation(r, o, v);
    }
    return r;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:ObjectTranslation.java


示例3: visitBlock

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitBlock(BlockTree arg0, EvaluationContext evaluationContext) {
    Mirror lastResult = null;
    try {
        evaluationContext.pushBlock();
        for (StatementTree statementTree : arg0.getStatements()) {
            Mirror res = statementTree.accept(this, evaluationContext);
            if (res != null) {
                lastResult = res;
            }
            if (res instanceof CommandMirror) {
                break;
            }
        }
    } finally {
        evaluationContext.popBlock();
    }
    return lastResult;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:EvaluatorVisitor.java


示例4: visitDoWhileLoop

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitDoWhileLoop(DoWhileLoopTree arg0, EvaluationContext evaluationContext) {
    ExpressionTree condition = arg0.getCondition();
    Tree statement = arg0.getStatement();
    Mirror result = null;
    do {
        try {
            evaluationContext.pushBlock();
            Mirror res = statement.accept(this, evaluationContext);
            if (res instanceof Break) {
                break;
            } else if (res instanceof Continue) {
                continue;
            }
            if (res != null) {
                result = res;
            }
        } finally {
            evaluationContext.popBlock();
        }
    } while (evaluateCondition(arg0, evaluationContext, condition));
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:EvaluatorVisitor.java


示例5: visitIf

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitIf(IfTree arg0, EvaluationContext evaluationContext) {
    boolean evaluatedCondition = evaluateCondition(arg0, evaluationContext, arg0.getCondition());
    StatementTree statement;
    if (evaluatedCondition) {
        statement = arg0.getThenStatement();
    } else {
        statement = arg0.getElseStatement();
    }
    if (statement != null) {
        try {
            evaluationContext.pushBlock();
            return statement.accept(this, evaluationContext);
        } finally {
            evaluationContext.popBlock();
        }
    } else {
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:EvaluatorVisitor.java


示例6: visitArrayAccess

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

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitReturn(ReturnTree arg0, EvaluationContext evaluationContext) {
    ExpressionTree exprTree = arg0.getExpression();
    Mirror result;
    if (exprTree == null) {
        VirtualMachine vm = evaluationContext.getDebugger().getVirtualMachine();
        if (vm == null) {
            return null;
        }
        // vm.mirrorOfVoid(); [TODO]
        result = null;
    } else {
        result = exprTree.accept(this, evaluationContext);
    }
    return new Return(result);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:EvaluatorVisitor.java


示例8: visitArrayType

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitArrayType(ArrayTypeTree arg0, EvaluationContext evaluationContext) {
    Mirror arrayType = arg0.getType().accept(this, evaluationContext);
    if (!(arrayType instanceof Type)) {
        return arrayType;
    }
    Type type = (Type) arrayType;
    String arrayClassName = type.name()+"[]";
    ReferenceType aType = getOrLoadClass(type.virtualMachine(), arrayClassName, evaluationContext);
    if (aType != null) {
        return aType;
    } else {
        Assert.error(arg0, "unknownType", arrayClassName);
        return null;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:EvaluatorVisitor.java


示例9: visitInstanceOf

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitInstanceOf(InstanceOfTree arg0, EvaluationContext evaluationContext) {
    Mirror expr = arg0.getExpression().accept(this, evaluationContext);
    VirtualMachine vm = evaluationContext.getDebugger().getVirtualMachine();
    if (vm == null) {
        return null;
    }
    if (expr == null) {
        return mirrorOf(vm, false);
    }
    Assert.assertAssignable(expr, ObjectReference.class, arg0, "instanceOfLeftOperandNotAReference", expr);

    ReferenceType expressionType = ((ObjectReference) expr).referenceType();
    Type type = (Type) arg0.getType().accept(this, evaluationContext);

    return mirrorOf(vm, instanceOf(expressionType, type));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:EvaluatorVisitor.java


示例10: visitWhileLoop

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitWhileLoop(WhileLoopTree arg0, EvaluationContext evaluationContext) {
    ExpressionTree condition = arg0.getCondition();
    Tree statement = arg0.getStatement();
    Mirror result = null;
    while (evaluateCondition(arg0, evaluationContext, condition)) {
        try {
            evaluationContext.pushBlock();
            Mirror res = statement.accept(this, evaluationContext);
            if (res instanceof Break) {
                break;
            } else if (res instanceof Continue) {
                continue;
            }
            if (res != null) {
                result = res;
            }
        } finally {
            evaluationContext.popBlock();
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:EvaluatorVisitor.java


示例11: translateExisting

import com.sun.jdi.Mirror; //导入依赖的package包/类
/**
 * Gen an existing wrapper object translation of a debuggee Mirror.
 *
 * @param o the Mirror object in the debuggee
 * @return translated object or <code>null</code> when there is no existing
 *         translation.
 */
public Object translateExisting(Mirror o) {
    Object r = null;
    synchronized (cache) {
        WeakReference wr = cache.get (o);
        if (wr != null)
            r = wr.get ();
    }
    return r;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ObjectTranslation.java


示例12: remove

import com.sun.jdi.Mirror; //导入依赖的package包/类
/**
 * Explicitly remove the translation of the mirror object.
 */
public void remove(Mirror o) {
    synchronized (cache) {
        cache.remove(o);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:ObjectTranslation.java


示例13: scan

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror scan(Tree tree, EvaluationContext evaluationContext) {
    Mirror result = super.scan(tree, evaluationContext);
    if (result instanceof ArtificialMirror) {
        return ((ArtificialMirror) result).getVMMirror();
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:EvaluatorVisitor.java


示例14: visitAssignment

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitAssignment(AssignmentTree arg0, EvaluationContext evaluationContext) {
    Mirror var = arg0.getVariable().accept(this, evaluationContext);
    Mirror exp = arg0.getExpression().accept(this, evaluationContext);
    Value value = (Value) exp;
    return setToMirror(arg0.getVariable(), value, evaluationContext);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EvaluatorVisitor.java


示例15: visitBreak

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitBreak(BreakTree arg0, EvaluationContext evaluationContext) {
    Name label = arg0.getLabel();
    if (label != null) {
        Assert.error(arg0, "unsupported");
        return null;
    }
    return new Break();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EvaluatorVisitor.java


示例16: visitConditionalExpression

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitConditionalExpression(ConditionalExpressionTree arg0, EvaluationContext evaluationContext) {
    boolean isTrue = evaluateCondition(arg0, evaluationContext, arg0.getCondition());
    if (isTrue) {
        return arg0.getTrueExpression().accept(this, evaluationContext);
    } else {
        return arg0.getFalseExpression().accept(this, evaluationContext);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EvaluatorVisitor.java


示例17: visitContinue

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitContinue(ContinueTree arg0, EvaluationContext evaluationContext) {
    Name label = arg0.getLabel();
    if (label != null) {
        Assert.error(arg0, "unsupported");
        return null;
    }
    return new Continue();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EvaluatorVisitor.java


示例18: visitForLoop

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitForLoop(ForLoopTree arg0, EvaluationContext evaluationContext) {
    try {
        evaluationContext.pushBlock();
        for (StatementTree st : arg0.getInitializer()) {
            st.accept(this, evaluationContext);
        }
        Mirror result = null;
        ExpressionTree condition = arg0.getCondition();
        List<? extends ExpressionStatementTree> updateList = arg0.getUpdate();
        StatementTree statement = arg0.getStatement();
        while (condition == null || evaluateCondition(arg0, evaluationContext, condition)) {
            Mirror value = null;
            try {
                evaluationContext.pushBlock();
                value = statement.accept(this, evaluationContext);
                if (value instanceof Break) {
                    break;
                } else if (value instanceof Continue) {
                    continue;
                }
                if (value != null) {
                    result = value;
                }
            } finally {
                evaluationContext.popBlock();
                if ((value instanceof Continue) || !(value instanceof CommandMirror)) {
                    for (Tree tree : updateList) {
                        tree.accept(this, evaluationContext);
                    } // for
                } // if
            } // finally
        } // while
        return result;
    } finally {
        evaluationContext.popBlock();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:EvaluatorVisitor.java


示例19: evaluateCondition

import com.sun.jdi.Mirror; //导入依赖的package包/类
private boolean evaluateCondition(Tree arg0, EvaluationContext evaluationContext, ExpressionTree condition) {
    Mirror conditionValue = condition.accept(this, evaluationContext);
    if (conditionValue instanceof ObjectReference) {
        conditionValue = unboxIfCan(arg0, (ObjectReference) conditionValue, evaluationContext);
    }
    if (!(conditionValue instanceof BooleanValue)) {
        String type = "N/A";    // NOI18N
        if (conditionValue instanceof Value) {
            type = ((Value) conditionValue).type().name();
        }
        Assert.error(arg0, "notABoolean", condition.toString(), conditionValue, type);
    }
    return ((BooleanValue) conditionValue).value();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:EvaluatorVisitor.java


示例20: visitPrimitiveType

import com.sun.jdi.Mirror; //导入依赖的package包/类
@Override
public Mirror visitPrimitiveType(PrimitiveTypeTree arg0, EvaluationContext evaluationContext) {
    TypeKind type = arg0.getPrimitiveTypeKind();
    VirtualMachine vm = evaluationContext.getDebugger().getVirtualMachine();
    if (vm == null) {
        return null;
    }
    switch(type) {
        case BOOLEAN:
            return vm.mirrorOf(true).type();
        case BYTE:
            return vm.mirrorOf((byte) 0).type();
        case CHAR:
            return vm.mirrorOf('a').type();
        case DOUBLE:
            return vm.mirrorOf(0.).type();
        case FLOAT:
            return vm.mirrorOf(0f).type();
        case INT:
            return vm.mirrorOf(0).type();
        case LONG:
            return vm.mirrorOf(0l).type();
        case SHORT:
            return vm.mirrorOf((short) 0).type();
        case VOID:
            return vm.mirrorOfVoid().type();
        default:
            throw new IllegalStateException("Tree = "+arg0);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:EvaluatorVisitor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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