RFR: 8332161: Test restoring echo in the Console implementation (java.base) [v9]
Naoto Sato
naoto at openjdk.org
Thu Jun 6 17:54:45 UTC 2024
On Thu, 6 Jun 2024 17:08:45 GMT, Naoto Sato <naoto at openjdk.org> wrote:
>> test/jdk/java/io/Console/RestoreEchoTest.java line 72:
>>
>>> 70: "--add-opens=java.base/jdk.internal.io=ALL-UNNAMED",
>>> 71: "-Djdk.console=java.base",
>>> 72: "-classpath", testClasses,
>>
>> Consider this. If we remove `-classpath` (and `var testClasses`), not only will nothing break, but we'll be also able to use JUnit assertions and assumptions in `main` instead of manual check-then-throw. This will work because the expect-process will inherit the environment, which captures `CLASSPATH` ( see https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/lang/ProcessBuilder.html#start() ).
>>
>> Again, the above is just something to consider. For all I know, you might've considered it already and rejected.
>
> I haven't considered that. Removed.
Turned out that removing the classpath ends up not finding the test class:
Error: Could not find or load main class RestoreEchoTest
Caused by: java.lang.ClassNotFoundException: RestoreEchoTest
];
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19315#discussion_r1629984403
More information about the core-libs-dev
mailing list