Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8167128

jshell tool: /drop of statement gives confusing output

XMLWordPrintable

    • b141
    • Verified

      Reported by Paul Deitel.

      ------------

      jshell> int x = 1
      x ==> 1

      jshell> int y = 3
      y ==> 3

      jshell> if (x < y) {
         ...> printf("%d is less than %d", x, y);
         ...> }
      1 is less than 3
      jshell> /list

         1 : int x = 1;
         2 : int y = 3;
         3 : if (x < y) {
                printf("%d is less than %d", x, y);
             }

      jshell> /drop 3
      | This command does not accept the snippet '3' : if (x < y) {
      | printf("%d is less than %d", x, y);
      | }
      | See /types, /methods, /vars, or /list

      jshell> /list 3

         3 : if (x < y) {
                printf("%d is less than %d", x, y);
             }

      jshell> /drop 1
      | dropped variable x

      -------------------------

      The message should be clearer why it is not accepted.

      OR, though it does not effect execution state, drop of a statement (at the API level) could/should just change the status of the Snippet as it does for DeclarationSnippets.

            rfield Robert Field (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: