本文整理汇总了Java中com.sun.jdi.Mirror类的典型用法代码示例。如果您正苦于以下问题:Java Mirror类的具体用法?Java Mirror怎么用?Java Mirror使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Mirror类属于com.sun.jdi包,在下文中一共展示了Mirror类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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;
}
}
示例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));
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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);
}
示例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();
}