On Mon, 28 Sep 2026 01:39:01 GMT, Heetae Park <[email protected]> wrote:
> The example in the class description of `DrbgParameters.Capability` does not
> compile as written.
>
> This patch fixes two issues in the Javadoc example:
>
> - `DrbgParameters(-1, requested, null)` → `DrbgParameters.instantiation(-1,
> requested, null)`.
> The constructor is private; `instantiation()` is the factory method used by
> every other
> example in this file.
> - `(DrbgParametes.Initiate)` → `(DrbgParameters.Instantiation)`. Class name
> typo and a
> nested type that does not exist.
>
> Javadoc-only change; no behavior change.
>
> ### Testing
>
> Copied the example into a standalone program and ran it on JDK 27 (build
> 27+35) for all
> three `Capability` values.
>
> Original snippet fails to compile:
> error: cannot find symbol method DrbgParameters(int,Capability,<null>)
> error: package DrbgParametes does not exist
>
> Corrected snippet compiles and the effective capabilities match the table in
> the Javadoc:
> PR_AND_RESEED -> PR_AND_RESEED
> RESEED_ONLY -> RESEED_ONLY NONE -> RESEED_ONLY (one of
> the allowed values for NONE)
>
> <details>
>
> ```java
> import java.security.DrbgParameters;
> import java.security.DrbgParameters.Capability;
> import java.security.SecureRandom;
>
> public class CapabilityExample {
> public static void main(String[] args) throws Exception {
> for (Capability requested : Capability.values()) {
> SecureRandom s = SecureRandom.getInstance("DRBG",
> DrbgParameters.instantiation(-1, requested, null));
> Capability effective = ((DrbgParameters.Instantiation)
> s.getParameters())
> .getCapability();
> System.out.println(requested.name() + " -> " + effective.name());
> }
> }
> }
>
> </details>
>
> Discussion:
> https://mail.openjdk.org/archives/list/[email protected]/thread/U24LZRYEMIUT5PIQ6OJZVOKO4Y4G2BJ3/
>
> @wangweij Could you take a look? Thanks!
>
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK
> Interim AI Policy](https://openjdk.org/legal/ai).
This pull request has now been integrated.
Changeset: 7b8c2716
Author: Heetae Park <[email protected]>
Committer: Weijun Wang <[email protected]>
URL:
https://git.openjdk.org/jdk/commit/7b8c2716a31342a20d6fae1c4c3ce6ffbe74e56a
Stats: 3 lines in 1 file changed: 0 ins; 0 del; 3 mod
8392624: Example in DRBGParameters.Capability class description has typo and is
incorrect
Reviewed-by: weijun
-------------
PR: https://git.openjdk.org/jdk/pull/33086