-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8305714 : Add an extra test for JDK-8292755 #13719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
8305714 : Add an extra test for JDK-8292755 #13719
Conversation
👋 Welcome back weibxiao! A progress list of the required criteria for merging this PR into |
Webrevs
|
|
||
/** | ||
* @test | ||
* @bug 8305714 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
8292755 would be the bug ID here since it refers to the product bug.
Is there a reason why you couldn't fold this test into the test/langtools/jdk/jshell/ClassesTest.java test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the bug ID.
Assuming ClassesTest is to verify the definition of Class.
After applying the patch, this test can catch the following error message described in the attached file in JShell Console.
Without the patch of 8292755 for JDK17, JShell will crash with this test case. After applying this patch in JDK17U, JShell console will print something like below,
Exception in thread "main" java.lang.InternalError: Exception during analyze - java.lang.AssertionError: isSubtype UNKNOWN
at jdk.jshell/jdk.jshell.TaskFactory$AnalyzeTask.analyze(TaskFactory.java:415)
at jdk.jshell/jdk.jshell.TaskFactory$AnalyzeTask.(TaskFactory.java:406)
at jdk.jshell/jdk.jshell.TaskFactory.lambda$analyze$1(TaskFactory.java:178)
at jdk.jshell/jdk.jshell.TaskFactory.lambda$runTask$4(TaskFactory.java:213)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskPool.getTask(JavacTaskPool.java:193)
at jdk.jshell/jdk.jshell.TaskFactory.runTask(TaskFactory.java:206)
at jdk.jshell/jdk.jshell.TaskFactory.analyze(TaskFactory.java:175)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - minor suggestions
/** | ||
* @test | ||
* @bug 8292755 | ||
* @summary make sure JShell not crashing while throwing undefined exception |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd suggest "InternalError seen while throwing undefined exception" as summary.
"interface RunnableWithThrowable {\n" + | ||
" void run() throws Throwable;\n" + | ||
"\n" + | ||
" // You can also replace `static` with `default` and test again\n" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the comment in test code ? maybe you can create a 2nd test instead :
public void testUndefinedClass1() throws Exception{
String code = "@FunctionalInterface\n" +
"interface RunnableWithThrowable {\n" +
" void run() throws Throwable;\n" +
"\n" +
" default RunnableWithThrowable getInstance() {\n" +
" return () -> { throw new NotExist(); };\n" +
" }\n" +
"}";
// set terminal height so that help output won't hit page breaks
System.setProperty("test.terminal.height", "1000000");
doRunTest((inputSink, out) -> {
inputSink.write(code + "\n");
waitOutput(out, "NotExist");
});
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the summary. And I remove the code to set the terminal height. I don't think it is necessary since there are only two lines for the print-out.
This reverts commit 36e72a6.
@lahodaj , let me know if you have any concerns and comments. Thanks. |
@weibxiao This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been 110 new commits pushed to the
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details. As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@coffeys) but any other Committer may sponsor as well. ➡️ To flag this PR as ready for integration with the above commit message, type |
/integrate |
/sponsor |
Going to push as commit 746f8d1.
Your commit was automatically rebased without conflicts. |
Add a testing case for undefined classes in Java JShell to make sure JShell does not crash when an undefined class is used.
This test was passed for Linux, MacOS, and Windows by mach5 build and test in Oracle.
Reviewer: @coffeys @lahodaj
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/13719/head:pull/13719
$ git checkout pull/13719
Update a local copy of the PR:
$ git checkout pull/13719
$ git pull https://git.openjdk.org/jdk.git pull/13719/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 13719
View PR using the GUI difftool:
$ git pr show -t 13719
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/13719.diff
Webrev
Link to Webrev Comment