RFR: 7903166: jtreg crashes trying to compile .jasm with enablePreview=true

Jonathan Gibbons jjg at openjdk.java.net
Fri Apr 15 16:09:01 UTC 2022


On Fri, 15 Apr 2022 06:24:52 GMT, Evgeny Nikitin <enikitin at openjdk.org> wrote:

> The bug: [CODETOOLS-7903166](https://bugs.openjdk.java.net/browse/CODETOOLS-7903166)
> 
> A small fix targeting crashes that occurs when jtreg compiles non-javac files with enablePreview. Prior the fix, the code crashed trying to insert arguments into javacArgs list using negative index.
> 
> Testing: test/preview folder self-tests.

Good catch; one improvement suggested.

src/share/classes/com/sun/javatest/regtest/exec/CompileAction.java line 367:

> 365:         }
> 366: 
> 367:         if (insertPos != -1 && script.enablePreview() && !seenEnablePreview) {

The fix would be clearer and more self-explanatory if you used the boolean `runJavac`. instead of the expression `insertPos != -1`.  It is already the case that `runJavac` implies `insertPos` is not `-1`.

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

Changes requested by jjg (Lead).

PR: https://git.openjdk.java.net/jtreg/pull/77


More information about the jtreg-dev mailing list