Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8265280

Remove unused RandomGeneratorFactory.all(Class<T> category)

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 17
    • core-libs
    • None
    • source
    • minimal
    • Method was marked as @hidden and and not part of the public API. The method does not exist in a release version of the JDK.
    • Java API
    • SE

      Summary

      RandomGeneratorFactory.all(Class<T> category) is no longer needed.

      Problem

      RandomGeneratorFactory.all(Class<T> category) was needed, during development, to supply lists of RandomGeneratorFactory to the all methods of RandomGenerator sub-interfaces. When the RandomGeneratorFactory API was finalized, RandomGeneratorFactory.all() API had been enhanced to provide similar functionality and the all methods of RandomGenerator sub-interfaces were removed without removing RandomGeneratorFactory.all(Class<T> category).

      Solution

      Since the method provides no useful public API, simply remove the method.

      Specification

      diff --git a/src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java b/src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java
      index c0956545bf8..44f2b0c3c71 100644
      --- a/src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java
      +++ b/src/java.base/share/classes/java/util/random/RandomGeneratorFactory.java
      @@ -370,31 +370,6 @@ public final class RandomGeneratorFactory<T extends RandomGenerator> {
               return factoryOf("L32X64MixRandom", RandomGenerator.class);
           }
      
      -    /**
      -     * Returns a stream of matching Providers.
      -     *
      -     * @param category  {@link RandomGenerator} sub-interface class to filter
      -     * @param <T>       {@link RandomGenerator} sub-interface return type
      -     *
      -     * RandomGenerators that are marked as deprecated or are not properly configured are not included in the result.
      -     *
      -     * @implSpec Availability is determined by RandomGeneratorFactory using the service provider API
      -     * to locate implementations of the RandomGenerator interface.
      -     *
      -     * @return Stream of matching {@link RandomGeneratorFactory RandomGeneratorFactory(s)}.
      -     *
      -     * @hidden
      -     */
      -    public static <T extends RandomGenerator> Stream<RandomGeneratorFactory<T>> all(Class<T> category) {
      -        Map<String, Provider<? extends RandomGenerator>> fm = getFactoryMap();
      -        return fm.values()
      -                 .stream()
      -                 .filter(p -> isSubclass(category, p) &&
      -                              !p.type().isAnnotationPresent(Deprecated.class) &&
      -                              p.type().isAnnotationPresent(RandomGeneratorProperties.class))
      -                 .map(RandomGeneratorFactory::new);
      -    }
      -
           /**
            * Returns a non-empty stream of available {@link RandomGeneratorFactory RandomGeneratorFactory(s)}.
            *

            jlaskey Jim Laskey
            jlaskey Jim Laskey
            Joe Darcy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: