On Mon, 16 May 2022 22:49:09 GMT, Jonathan Gibbons <j...@openjdk.org> wrote:
>> test/langtools/jdk/javadoc/doclet/testSnippetTag/TestSnippetUnnamedPackage.java >> line 82: >> >>> 80: >>> 81: javadoc(args.toArray(String[]::new)); >>> 82: checkExit(useSourcePath ? Exit.OK : Exit.ERROR); >> >> Thanks for taking into account our discussion in #8583. >> >> On the one hand, this way of conditionally adding an option is more >> mouthful. On the other hand, it doesn't make a first-time reader scratch >> their head and makes for a cleaner test. > > Going forward, how about an `Args` builder, with fluent methods > `add(String)`, `addAll(String...)`, `addAll(List<String>)` and > `add(Optional<String>)` ... although that last one will cause warnings from > javac which grumbles about using `Optional` as a parameter type. > > Instead of using `Optional`, we could have overloads `addIf(boolean, String)` > etc. > > I'm open to suggestions for a better/neater methodology here. [JDK-8286842](https://bugs.openjdk.java.net/browse/JDK-8286842) ------------- PR: https://git.openjdk.java.net/jdk/pull/8708