On Tue, 7 Mar 2023 23:56:29 GMT, Jonathan Gibbons <[email protected]> wrote:
>> Pavel Rappo has updated the pull request incrementally with one additional >> commit since the last revision: >> >> Respond to feedback > > src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java > line 1031: > >> 1029: // TODO: this computation should be eventually delegated to >> VisibleMemberTable >> 1030: Set<TypeElement> alreadySeen = null; >> 1031: assert (alreadySeen = new HashSet<>()) != null; // create set >> conditionally > > I think this use of `assert` (here and lower down) is a step too far. It's > one thing to use asserts to verify invariants; it's too much to use them to > conditionally compute state like this. That hash map is needed iff assertions are enabled. For an ordinary run, creating that hash map could be wasteful. Perhaps I could create a hash map unconditionally using `HashMap.newHashMap(0)`; would that be to your liking? ------------- PR: https://git.openjdk.org/jdk/pull/12887
