8153551: jshell tool: no longer a mechanism to see current feedback modes
authorrfield
Wed, 20 Apr 2016 08:35:44 -0700
changeset 37640 42e5136a367c
parent 37639 d4828c4d569c
child 37641 6949903ba85a
8153551: jshell tool: no longer a mechanism to see current feedback modes Reviewed-by: jlahoda
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java
langtools/test/jdk/jshell/ToolFormatTest.java
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Wed Apr 20 08:30:30 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Wed Apr 20 08:35:44 2016 -0700
@@ -606,6 +606,7 @@
                 fluffmsg("jshell.msg.feedback.mode", mode.name);
             } else {
                 fluffmsg("jshell.msg.see", "/help /set feedback");
+                printFeedbackModes();
             }
             return valid;
         }
@@ -671,13 +672,17 @@
                 } else {
                     errorat("jshell.err.feedback.ambiguous.mode", umode);
                 }
-                fluffmsg("jshell.msg.feedback.mode.following");
-                modeMap.keySet().stream()
-                        .forEach(mk -> fluff("   %s", mk));
+                printFeedbackModes();
                 return null;
             }
         }
 
+        void printFeedbackModes() {
+            fluffmsg("jshell.msg.feedback.mode.following");
+            modeMap.keySet().stream()
+                    .forEach(mk -> fluff("   %s", mk));
+        }
+
         // Test if the format string is correctly
         final String nextFormat() {
             String format = at.next();
--- a/langtools/test/jdk/jshell/ToolFormatTest.java	Wed Apr 20 08:30:30 2016 -0700
+++ b/langtools/test/jdk/jshell/ToolFormatTest.java	Wed Apr 20 08:35:44 2016 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8148316 8148317 8151755 8152246
+ * @bug 8148316 8148317 8151755 8152246 8153551
  * @summary Tests for output customization
  * @library /tools/lib
  * @modules jdk.compiler/com.sun.tools.javac.api
@@ -155,6 +155,12 @@
         }
     }
 
+    public void testShowFeedbackModes() {
+        test(
+                (a) -> assertCommandOutputContains(a, "/set feedback", "normal")
+        );
+    }
+
     public void testSetNewModeQuiet() {
         try {
             test(