8080352: jshell tool: Error message for using "package" should be more descriptive than "Failed"
authorrfield
Wed, 07 Sep 2016 12:15:22 -0700
changeset 40836 2c3901225ff2
parent 40835 6ab9ed1abc46
child 40837 d071bcc8d32e
8080352: jshell tool: Error message for using "package" should be more descriptive than "Failed" Reviewed-by: jlahoda
langtools/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java
langtools/test/jdk/jshell/RejectedFailedTest.java
--- a/langtools/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Tue Sep 06 17:04:43 2016 -0700
+++ b/langtools/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Wed Sep 07 12:15:22 2016 -0700
@@ -95,24 +95,6 @@
             mods = modifiersOpt();
         }
 
-        if (token.kind == PACKAGE) {
-            int packagePos = token.pos;
-            List<JCAnnotation> annotations = List.nil();
-            seenPackage = true;
-            if (mods != null) {
-                checkNoMods(mods.flags);
-                annotations = mods.annotations;
-                mods = null;
-            }
-            nextToken();
-            JCExpression pid = qualident(false);
-            accept(SEMI);
-            JCPackageDecl pd = F.at(packagePos).PackageDecl(annotations, pid);
-            attach(pd, firstToken.comment(CommentStyle.JAVADOC));
-            storeEnd(pd, token.pos);
-            defs.append(pd);
-        }
-
         boolean firstTypeDecl = true;
         while (token.kind != EOF) {
             if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) {
--- a/langtools/test/jdk/jshell/RejectedFailedTest.java	Tue Sep 06 17:04:43 2016 -0700
+++ b/langtools/test/jdk/jshell/RejectedFailedTest.java	Wed Sep 07 12:15:22 2016 -0700
@@ -22,7 +22,7 @@
  */
 
 /*
- * @test
+ * @test 8080352
  * @summary Tests for hard errors, like syntax errors
  * @build KullaTesting
  * @run testng RejectedFailedTest
@@ -81,6 +81,7 @@
                 " a b c",
                 ")",
                 "class interface A",
+                "package foo;"
         };
         checkByKind(inputsErroneous, Kind.ERRONEOUS);
     }