langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
changeset 38535 4a25025e0b0d
parent 38531 c449daa25b45
child 38539 71874886920f
equal deleted inserted replaced
38534:425b30506f80 38535:4a25025e0b0d
    99 import jdk.internal.jshell.tool.Feedback.FormatErrors;
    99 import jdk.internal.jshell.tool.Feedback.FormatErrors;
   100 import jdk.internal.jshell.tool.Feedback.FormatResolve;
   100 import jdk.internal.jshell.tool.Feedback.FormatResolve;
   101 import jdk.internal.jshell.tool.Feedback.FormatUnresolved;
   101 import jdk.internal.jshell.tool.Feedback.FormatUnresolved;
   102 import jdk.internal.jshell.tool.Feedback.FormatWhen;
   102 import jdk.internal.jshell.tool.Feedback.FormatWhen;
   103 import static java.util.stream.Collectors.toList;
   103 import static java.util.stream.Collectors.toList;
       
   104 import static jdk.jshell.Snippet.SubKind.VAR_VALUE_SUBKIND;
   104 import static java.util.stream.Collectors.toMap;
   105 import static java.util.stream.Collectors.toMap;
   105 import static jdk.jshell.Snippet.SubKind.VAR_VALUE_SUBKIND;
   106 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_COMPA;
       
   107 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_DEP;
       
   108 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_EVNT;
       
   109 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_FMGR;
       
   110 import static jdk.internal.jshell.debug.InternalDebugControl.DBG_GEN;
   106 
   111 
   107 /**
   112 /**
   108  * Command line REPL tool for Java using the JShell API.
   113  * Command line REPL tool for Java using the JShell API.
   109  * @author Robert Field
   114  * @author Robert Field
   110  */
   115  */
  1342     }
  1347     }
  1343 
  1348 
  1344     boolean cmdDebug(String arg) {
  1349     boolean cmdDebug(String arg) {
  1345         if (arg.isEmpty()) {
  1350         if (arg.isEmpty()) {
  1346             debug = !debug;
  1351             debug = !debug;
  1347             InternalDebugControl.setDebugFlags(state, debug ? InternalDebugControl.DBG_GEN : 0);
  1352             InternalDebugControl.setDebugFlags(state, debug ? DBG_GEN : 0);
  1348             fluff("Debugging %s", debug ? "on" : "off");
  1353             fluff("Debugging %s", debug ? "on" : "off");
  1349         } else {
  1354         } else {
  1350             int flags = 0;
  1355             int flags = 0;
  1351             for (char ch : arg.toCharArray()) {
  1356             for (char ch : arg.toCharArray()) {
  1352                 switch (ch) {
  1357                 switch (ch) {
  1358                     case 'r':
  1363                     case 'r':
  1359                         debug = true;
  1364                         debug = true;
  1360                         fluff("REPL tool debugging on");
  1365                         fluff("REPL tool debugging on");
  1361                         break;
  1366                         break;
  1362                     case 'g':
  1367                     case 'g':
  1363                         flags |= InternalDebugControl.DBG_GEN;
  1368                         flags |= DBG_GEN;
  1364                         fluff("General debugging on");
  1369                         fluff("General debugging on");
  1365                         break;
  1370                         break;
  1366                     case 'f':
  1371                     case 'f':
  1367                         flags |= InternalDebugControl.DBG_FMGR;
  1372                         flags |= DBG_FMGR;
  1368                         fluff("File manager debugging on");
  1373                         fluff("File manager debugging on");
  1369                         break;
  1374                         break;
  1370                     case 'c':
  1375                     case 'c':
  1371                         flags |= InternalDebugControl.DBG_COMPA;
  1376                         flags |= DBG_COMPA;
  1372                         fluff("Completion analysis debugging on");
  1377                         fluff("Completion analysis debugging on");
  1373                         break;
  1378                         break;
  1374                     case 'd':
  1379                     case 'd':
  1375                         flags |= InternalDebugControl.DBG_DEP;
  1380                         flags |= DBG_DEP;
  1376                         fluff("Dependency debugging on");
  1381                         fluff("Dependency debugging on");
  1377                         break;
  1382                         break;
  1378                     case 'e':
  1383                     case 'e':
  1379                         flags |= InternalDebugControl.DBG_EVNT;
  1384                         flags |= DBG_EVNT;
  1380                         fluff("Event debugging on");
  1385                         fluff("Event debugging on");
  1381                         break;
  1386                         break;
  1382                     default:
  1387                     default:
  1383                         hard("Unknown debugging option: %c", ch);
  1388                         hard("Unknown debugging option: %c", ch);
  1384                         fluff("Use: 0 r g f c d");
  1389                         fluff("Use: 0 r g f c d");