@Override public Map<IWatchable, IValue> getWatchableValues() { try { StackFrame stackFrame = getStackFrame(); Map<IWatchable, IValue> result = new HashMap<IWatchable, IValue>(); if (stackFrame != null) { Map<LocalVariable, Value> map = stackFrame.getValues(stackFrame.visibleVariables()); for (LocalVariable variable : map.keySet()) { result.put( new JavaLocalVariable(variable, this, myClassFqName, stackFrame.thread()), JavaValue.fromJDIValue(map.get(variable), myClassFqName, stackFrame.thread())); } ObjectReference thisObject = stackFrame.thisObject(); if (thisObject != null) { JavaThisObject object = new JavaThisObject(thisObject, this, myClassFqName, stackFrame.thread()); result.put(object, object.getValue()); } } return result; } catch (AbsentInformationException ex) { // doing nothing return Collections.emptyMap(); } }
@Override public IValue getValue(IWatchable watchable) { if (watchable instanceof JavaLocalVariable) { JavaLocalVariable localVariable = (JavaLocalVariable) watchable; return JavaValue.fromJDIValue( getStackFrame().getValue(localVariable.getLocalVariable()), myClassFqName, myThreadReference); } return null; }