On Wed, 15 May 2024 09:51:23 GMT, Raffaello Giulietti <rgiulie...@openjdk.org> wrote:
>> All random number generator algorithms are implemented in module >> `java.base`. The usage of `ServiceLoader` in `j.u.r.RandomGeneratorFactory` >> is no longer needed. > > Raffaello Giulietti has updated the pull request incrementally with one > additional commit since the last revision: > > Small documentation changes. src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java line 204: > 202: new RandomGeneratorProperties(rgClass, name, group, > 203: i, j, k, equidistribution, > 204: flags | > (rgClass.isAnnotationPresent(Deprecated.class) ? DEPRECATED : 0))); Hello Raffaello, this is the final remaining reflection usage and even this I think isn't required now that all the random generator implementations reside within java.base as an implementation detail. I think we should just skip this annotation check here and set `DEPRECATED` bit on the `flags` to `0` for all implementations. When/if we do deprecate any of the random generators, we can just come here and switch that bit to on for the specific random generator when instantiating this `RandomGeneratorProperties` record. I had a brief look at the code and the documentation in `package-info.java` of `java/util/random` and we don't mention that we rely on the `@Deprecated` annotation to determine whether an algorithm is deprecated. I think that's a good thing. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/19212#discussion_r1603101449