IDEA-CR-13656: JavaStackFrame reverted; JSR45PositionManager: toList() used

This commit is contained in:
Tagir Valeev
2016-09-09 17:13:35 +07:00
parent a480d555d3
commit d6a072ba13
2 changed files with 15 additions and 9 deletions
@@ -31,6 +31,7 @@ import com.intellij.debugger.jdi.LocalVariablesUtil;
import com.intellij.debugger.jdi.StackFrameProxyImpl;
import com.intellij.debugger.settings.DebuggerSettings;
import com.intellij.debugger.settings.NodeRendererSettings;
import com.intellij.debugger.ui.breakpoints.Breakpoint;
import com.intellij.debugger.ui.impl.watch.*;
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
import com.intellij.lang.java.JavaLanguage;
@@ -54,6 +55,7 @@ import com.intellij.xdebugger.frame.presentation.XValuePresentation;
import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants;
import com.intellij.xdebugger.settings.XDebuggerSettingsManager;
import com.sun.jdi.*;
import com.sun.jdi.event.Event;
import com.sun.jdi.event.ExceptionEvent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -199,13 +201,18 @@ public class JavaStackFrame extends XStackFrame {
children.add(JavaValue.create(returnValueDescriptor, evaluationContext, myNodeManager));
}
// add context exceptions
DebuggerUtilsEx.getEventDescriptors(debuggerContext.getSuspendContext()).stream()
.map(pair -> pair.getSecond())
.filter(debugEvent -> debugEvent instanceof ExceptionEvent).map(debugEvent -> ((ExceptionEvent)debugEvent).exception())
.filter(Objects::nonNull).distinct()
.forEach(e -> children.add(
JavaValue.create(myNodeManager.getThrownExceptionObjectDescriptor(myDescriptor, e), evaluationContext, myNodeManager)));
Set<ObjectReference> exceptions = new HashSet<>();
for (Pair<Breakpoint, Event> pair : DebuggerUtilsEx.getEventDescriptors(debuggerContext.getSuspendContext())) {
Event debugEvent = pair.getSecond();
if (debugEvent instanceof ExceptionEvent) {
ObjectReference exception = ((ExceptionEvent)debugEvent).exception();
if (exception != null) {
exceptions.add(exception);
}
}
}
exceptions.forEach(e -> children.add(
JavaValue.create(myNodeManager.getThrownExceptionObjectDescriptor(myDescriptor, e), evaluationContext, myNodeManager)));
try {
buildVariables(debuggerContext, evaluationContext, debugProcess, children, thisObjectReference, location);
@@ -196,8 +196,7 @@ public abstract class JSR45PositionManager<Scope> implements PositionManager {
}
protected List<String> getRelativeSourePathsByType(final ReferenceType type) throws AbsentInformationException {
final List<String> paths = type.sourcePaths(myStratumId);
return paths.stream().map(this::getRelativePath).collect(Collectors.toCollection(ArrayList::new));
return type.sourcePaths(myStratumId).stream().map(this::getRelativePath).collect(Collectors.toList());
}
protected List<Location> getLocationsOfLine(final ReferenceType type, final String fileName,