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).

Looks good to me.

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

Marked as reviewed by weijun (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/33086#pullrequestreview-5339262115

Reply via email to