RFR: 8341735: Rewrite the build/AbsPathsInImage.java test to not load the entire file at once [v6]

Erik Joelsson erikj at openjdk.org
Wed Oct 22 19:51:10 UTC 2025


On Wed, 22 Oct 2025 17:53:59 GMT, Daniel Hu <duke at openjdk.org> wrote:

>> Daniel Hu has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - fix incorrect use of inputstream
>>  - remove extraneous variables/imports
>
> test/jdk/build/AbsPathsInImage.java line 313:
> 
>> 311:         }
>> 312:         System.out.println();
>> 313:     }
> 
> I wanted to keep the debug output as close to the original as possible. But the original method backtracks to a non-ascii value, and that gets really complicated with the new buffered solution as probably a 2nd buffer would need to be kept while not being able to guarantee a static space complexity requirement (as who knows how much bytes are between each pair of ascii bytes). Moreover, when the test passes, a 2nd buffer kept for debug output isn't even used, meaning a pointless space penalty for the common case.
> 
> Instead, I added a secondary function that simply re-scans the file when the test fails. That does mean the test might take twice as long during failure (and all the associated additional space requirements), but I think that's an acceptable tradeoff, as vast majority of runs won't receive this penalty.

I think that's a reasonable tradeoff.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26030#discussion_r2453185534


More information about the build-dev mailing list