RFR: 8369804: TestGenerators.java fails with IllegalArgumentException: bound must be greater than origin [v2]

Christian Hagedorn chagedorn at openjdk.org
Wed Oct 15 10:33:44 UTC 2025


On Wed, 15 Oct 2025 09:24:55 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> We sample two floats, assuming we would get two different results. But ever so rarely, we get the same values, and the test fails.
>> 
>> So now, I sample with retry. And also improve the error reporting, throwing an exception on generator construction rather than sampling from the generator.
>
> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Apply suggestions from code review

Looks good to me, too!

test/hotspot/jtreg/compiler/lib/generators/UniformDoubleGenerator.java line 38:

> 36:     public UniformDoubleGenerator(Generators g, double lo, double hi) {
> 37:         super(g, lo, hi);
> 38:         if (Double.compare(lo, hi) >= 0) throw new EmptyGeneratorException();

I suggest to add braces

Suggestion:

        if (Double.compare(lo, hi) >= 0) {
            throw new EmptyGeneratorException();
        }

test/hotspot/jtreg/compiler/lib/generators/UniformFloatGenerator.java line 38:

> 36:     public UniformFloatGenerator(Generators g, float lo, float hi) {
> 37:         super(g, lo, hi);
> 38:         if (Float.compare(lo, hi) >= 0) throw new EmptyGeneratorException();

Suggestion:

        if (Float.compare(lo, hi) >= 0) {
            throw new EmptyGeneratorException();
        }

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/27816#pullrequestreview-3339650938
PR Review Comment: https://git.openjdk.org/jdk/pull/27816#discussion_r2432037985
PR Review Comment: https://git.openjdk.org/jdk/pull/27816#discussion_r2432038866


More information about the hotspot-compiler-dev mailing list