src/share/classes/com/sun/tools/example/debug/tty/Commands.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


 918             }
 919         }
 920     }
 921 
 922     private void dumpFrame (int frameNumber, boolean showPC, StackFrame frame) {
 923         Location loc = frame.location();
 924         long pc = -1;
 925         if (showPC) {
 926             pc = loc.codeIndex();
 927         }
 928         Method meth = loc.method();
 929 
 930         long lineNumber = loc.lineNumber();
 931         String methodInfo = null;
 932         if (meth.isNative()) {
 933             methodInfo = MessageOutput.format("native method");
 934         } else if (lineNumber != -1) {
 935             try {
 936                 methodInfo = loc.sourceName() +
 937                     MessageOutput.format("line number",
 938                                          new Object [] {new Long(lineNumber)});
 939             } catch (AbsentInformationException e) {
 940                 methodInfo = MessageOutput.format("unknown");
 941             }
 942         }
 943         if (pc != -1) {
 944             MessageOutput.println("stack frame dump with pc",
 945                                   new Object [] {new Integer(frameNumber + 1),
 946                                                  meth.declaringType().name(),
 947                                                  meth.name(),
 948                                                  methodInfo,
 949                                                  new Long(pc)});
 950         } else {
 951             MessageOutput.println("stack frame dump",
 952                                   new Object [] {new Integer(frameNumber + 1),
 953                                                  meth.declaringType().name(),
 954                                                  meth.name(),
 955                                                  methodInfo});
 956         }
 957     }
 958 
 959     void commandWhere(StringTokenizer t, boolean showPC) {
 960         if (!t.hasMoreTokens()) {
 961             ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
 962             if (threadInfo == null) {
 963                 MessageOutput.println("No thread specified.");
 964                 return;
 965             }
 966             dumpStack(threadInfo, showPC);
 967         } else {
 968             String token = t.nextToken();
 969             if (token.toLowerCase().equals("all")) {




 918             }
 919         }
 920     }
 921 
 922     private void dumpFrame (int frameNumber, boolean showPC, StackFrame frame) {
 923         Location loc = frame.location();
 924         long pc = -1;
 925         if (showPC) {
 926             pc = loc.codeIndex();
 927         }
 928         Method meth = loc.method();
 929 
 930         long lineNumber = loc.lineNumber();
 931         String methodInfo = null;
 932         if (meth.isNative()) {
 933             methodInfo = MessageOutput.format("native method");
 934         } else if (lineNumber != -1) {
 935             try {
 936                 methodInfo = loc.sourceName() +
 937                     MessageOutput.format("line number",
 938                                          new Object [] {Long.valueOf(lineNumber)});
 939             } catch (AbsentInformationException e) {
 940                 methodInfo = MessageOutput.format("unknown");
 941             }
 942         }
 943         if (pc != -1) {
 944             MessageOutput.println("stack frame dump with pc",
 945                                   new Object [] {new Integer(frameNumber + 1),
 946                                                  meth.declaringType().name(),
 947                                                  meth.name(),
 948                                                  methodInfo,
 949                                                  Long.valueOf(pc)});
 950         } else {
 951             MessageOutput.println("stack frame dump",
 952                                   new Object [] {new Integer(frameNumber + 1),
 953                                                  meth.declaringType().name(),
 954                                                  meth.name(),
 955                                                  methodInfo});
 956         }
 957     }
 958 
 959     void commandWhere(StringTokenizer t, boolean showPC) {
 960         if (!t.hasMoreTokens()) {
 961             ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
 962             if (threadInfo == null) {
 963                 MessageOutput.println("No thread specified.");
 964                 return;
 965             }
 966             dumpStack(threadInfo, showPC);
 967         } else {
 968             String token = t.nextToken();
 969             if (token.toLowerCase().equals("all")) {