RFR: 8305714 : Add an extra test for JDK-8292755 [v2]

Sean Coffey coffeys at openjdk.org
Thu May 4 15:01:19 UTC 2023


On Fri, 28 Apr 2023 16:20:24 GMT, Weibing Xiao <duke at openjdk.org> wrote:

>> 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
>
> Weibing Xiao has updated the pull request incrementally with one additional commit since the last revision:
> 
>   modify bug id

Looks good - minor suggestions

test/langtools/jdk/jshell/UndefinedClassTest.java line 27:

> 25:  * @test
> 26:  * @bug 8292755
> 27:  * @summary make sure JShell not crashing while throwing undefined exception

I'd suggest "InternalError seen while throwing undefined exception" as summary.

test/langtools/jdk/jshell/UndefinedClassTest.java line 55:

> 53:                 " void run() throws Throwable;\n" +
> 54:                 "\n" +
> 55:                 " // You can also replace `static` with `default` and test again\n" +

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");
        });
    }

-------------

PR Review: https://git.openjdk.org/jdk/pull/13719#pullrequestreview-1413326124
PR Review Comment: https://git.openjdk.org/jdk/pull/13719#discussion_r1185147502
PR Review Comment: https://git.openjdk.org/jdk/pull/13719#discussion_r1185147670


More information about the kulla-dev mailing list