changeset 4298:e07ed6317649

8080352: jshell tool: Error message for using "package" should be more descriptive than "Failed" Reviewed-by: jlahoda
author rfield
date Wed, 07 Sep 2016 12:15:22 -0700
parents 589ff4d43428
children 560204c4944f
files src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java test/jdk/jshell/RejectedFailedTest.java
diffstat 2 files changed, 2 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jshell/share/classes/jdk/jshell/ReplParser.java	Tue Sep 06 17:04:43 2016 -0700
+++ b/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/test/jdk/jshell/RejectedFailedTest.java	Tue Sep 06 17:04:43 2016 -0700
+++ b/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);
     }