RFR: JDK-8293877: Rewrite MineField test

Jonathan Gibbons jjg at openjdk.org
Wed Sep 28 22:45:32 UTC 2022


On Thu, 22 Sep 2022 19:20:38 GMT, Martin Buchholz <martin at openjdk.org> wrote:

> Explicit OS command invocation and ToolProvider invocation both seem important to test. IIRC there were times when they were not in fact equivalent in effect. Consider library infrastructure to run both variants and ensure results are identical.
> 

@Martin-Buchholz 
Thanks for the feedback. While I understand what you are suggesting, I think it is potentially for a different test.

The goal here was to try and do a reasonably direct translation of the original code from shell to Java. And OK, I did do some minor optimizations to use javac's `ToolProvider` where possible, to save exec-ing processes unnecessarily.

Rewriting the test to do both (where that is even possible) would either be a significant rewrite or maybe involve running all of the test twice, in both modes. 

And, for javac, it might be even worse, because there is the `javax.tools.JavaCompiler` API as well.

There is no reason to suspect the functionality might be semantically different in these different ways to invoke javac. Once you get down into the compiler, the code paths are the same.   The difference is the _availability_ of features ... such as the _classpath wildcard_ feature, which is only available when using the native launcher.   So, if we were to write anything more in the way of tests, it would be to test the specified difference in availability of the features, without necessarily exercising the full functionality and comparing everything against the launcher for the Java runtime, `java`.

One other outcome from the overall work here: as a result of (re)discovering the _classpath wildcard_ feature, we realized that there were enough differences between the native launcher and the `ToolProvider` interface (and `JavaCompiler`) to justify a spec update for the `idk.compiler` module. This is being tracked in [JDK-8294546](https://bugs.openjdk.org/browse/JDK-8294546).

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

PR: https://git.openjdk.org/jdk/pull/10366


More information about the compiler-dev mailing list