8080352: jshell tool: Error message for using "package" should be more descriptive than "Failed"
Reviewed-by: jlahoda
--- 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);
}