Skip to content

Commit

Permalink
8332086: Remove the usage of ServiceLoader in j.u.r.RandomGeneratorFa…
Browse files Browse the repository at this point in the history
…ctory

8332476: j.u.r.RandomGeneratorFactor.create(long|byte[]) should throw rather than silently fallback to no-arg create()

Reviewed-by: jpai
  • Loading branch information
rgiulietti committed May 21, 2024
1 parent 5cf8288 commit 42e3c84
Show file tree
Hide file tree
Showing 19 changed files with 335 additions and 395 deletions.
7 changes: 1 addition & 6 deletions src/java.base/share/classes/java/security/SecureRandom.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand All @@ -25,7 +25,6 @@

package java.security;

import jdk.internal.util.random.RandomSupport.RandomGeneratorProperties;
import sun.security.jca.GetInstance;
import sun.security.jca.GetInstance.Instance;
import sun.security.jca.Providers;
Expand Down Expand Up @@ -149,10 +148,6 @@
* @since 1.1
*/

@RandomGeneratorProperties(
name = "SecureRandom",
isStochastic = true
)
public class SecureRandom extends java.util.Random {

private static final Debug pdebug =
Expand Down
9 changes: 1 addition & 8 deletions src/java.base/share/classes/java/util/Random.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -32,8 +32,6 @@
import java.util.stream.IntStream;
import java.util.stream.LongStream;

import jdk.internal.util.random.RandomSupport.*;

import static jdk.internal.util.random.RandomSupport.*;

import jdk.internal.misc.Unsafe;
Expand Down Expand Up @@ -77,11 +75,6 @@
* @author Frank Yellin
* @since 1.0
*/
@RandomGeneratorProperties(
name = "Random",
i = 48, j = 0, k = 0,
equidistribution = 0
)
public class Random implements RandomGenerator, java.io.Serializable {

/**
Expand Down
8 changes: 1 addition & 7 deletions src/java.base/share/classes/java/util/SplittableRandom.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -33,7 +33,6 @@
import java.util.stream.Stream;
import jdk.internal.util.random.RandomSupport;
import jdk.internal.util.random.RandomSupport.AbstractSplittableGenerator;
import jdk.internal.util.random.RandomSupport.RandomGeneratorProperties;

/**
* A generator of uniform pseudorandom values (with period 2<sup>64</sup>)
Expand Down Expand Up @@ -87,11 +86,6 @@
* @author Doug Lea
* @since 1.8
*/
@RandomGeneratorProperties(
name = "SplittableRandom",
i = 64, j = 0, k = 0,
equidistribution = 1
)
public final class SplittableRandom implements RandomGenerator, SplittableGenerator {

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,6 @@
* @since 1.7
* @author Doug Lea
*/

@RandomGeneratorProperties(
name = "ThreadLocalRandom",
i = 64, j = 0, k = 0,
equidistribution = 1
)
public final class ThreadLocalRandom extends Random {
/*
* This class implements the java.util.Random API (and subclasses
Expand Down
Loading

1 comment on commit 42e3c84

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.