RFR: 8272567: [IR Framework] Make AbstractInfo.getRandom() static

Christian Hagedorn chagedorn at openjdk.java.net
Tue Aug 17 10:20:40 UTC 2021


To use the dedicated (`private static final`) `Random` object of `AbstractInfo` one needs to use the non-static `getRandom()` method like this:


@Run(test = "myTest")
public void runMethodForMyTest(RunInfo info) {
   int x = info.getRandom().nextInt();
   myTest(x);
}


This simple patch makes `getRandom()` static to provide an easier access to it without the need to specify `RunInfo` as parameter:


@Run(test = "myTest")
public void runMethodForMyTest() {
   int x = RunInfo.getRandom().nextInt(); // or AbstractInfo.getRandom().nextInt()
   myTest(x);
}


Thanks,
Christian

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

Commit messages:
 - [IR Framework] Make AbstractInfo.getRandom() static

Changes: https://git.openjdk.java.net/jdk/pull/5139/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5139&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8272567
  Stats: 3 lines in 2 files changed: 0 ins; 0 del; 3 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5139.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5139/head:pull/5139

PR: https://git.openjdk.java.net/jdk/pull/5139


More information about the hotspot-compiler-dev mailing list