EA-94729 - IE: StackFrameItem.lambda$createFrames$

This commit is contained in:
Egor.Ushakov
2017-02-10 12:56:10 +03:00
parent e88322304e
commit ece87efcca
5 changed files with 17 additions and 25 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -305,14 +305,8 @@ public class ThreadDumpAction extends AnAction implements AnAction.TransparentUp
methodName.append(e.getMessage());
}
int lineNumber;
try {
lineNumber = location.lineNumber();
}
catch (Throwable e) {
lineNumber = -1;
}
return DebuggerBundle.message("export.threads.stackframe.format", methodName.toString(), sourceName, lineNumber);
return DebuggerBundle.message("export.threads.stackframe.format", methodName.toString(), sourceName,
DebuggerUtilsEx.getLineNumber(location, false));
}
private static String threadName(ThreadReference threadReference) {
@@ -141,13 +141,7 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
LOG.assertTrue(myDebugProcess != null);
int lineNumber;
try {
lineNumber = location.lineNumber() - 1;
}
catch (InternalError e) {
lineNumber = -1;
}
int lineNumber = DebuggerUtilsEx.getLineNumber(location, true);
String qName = location.declaringType().name();
@@ -600,6 +600,15 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
}
}
public static int getLineNumber(Location location, boolean zeroBased) {
try {
return location.lineNumber() - (zeroBased ? 1 : 0);
}
catch (InternalError e) {
return -1;
}
}
public static Value createValue(VirtualMachineProxyImpl vm, String expectedType, double value) {
if (PsiType.DOUBLE.getPresentableText().equals(expectedType)) {
return vm.mirrorOf(value);
@@ -66,7 +66,7 @@ public class StackFrameItem {
}
public int line() {
return myLocation.lineNumber();
return DebuggerUtilsEx.getLineNumber(myLocation, false);
}
@NotNull
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ import com.intellij.debugger.engine.CompoundPositionManager;
import com.intellij.debugger.engine.DebugProcess;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.jdi.VirtualMachineProxy;
import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.requests.ClassPrepareRequestor;
import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.application.ApplicationManager;
@@ -240,13 +241,7 @@ public class GroovyPositionManager implements PositionManager {
private int calcLineIndex(Location location) {
LOG.assertTrue(myDebugProcess != null);
if (location == null) return -1;
try {
return location.lineNumber() - 1;
}
catch (InternalError e) {
return -1;
}
return DebuggerUtilsEx.getLineNumber(location, true);
}
@Nullable