> This addresses an oversight in the support for records. > > The fix could have been as simple as a one-word addition to a list of element > kinds to check for nested classes. However, instead of that, the fix is more > of a cleanup of a group of methods in `Utils` to fix this issue and to reduce > the likelihood of anything similar happening again, when the next new kind of > class is added. > > The cleanup uses new code idioms using lambdas, predicates, and generic > methods to replace varargs and temporary sets and copying lists. The naming > is somewhat cleaned up as well, but it was a self-imposed restriction that > the cleanup is limited to the `Utils` class, and does not leak into clients > of the class. > > There is a core `getItems` method which is somewhat multi-purpose, supporting > recursive and non-recursive use, and examining either just documented members > or all members, including members that are not directly documented. (The > latter occurs mostly in serialization.) It is possible there is a future > refactoring to further improve this method, perhaps to break it into > different methods. With that in mind, the signature of some methods was > narrowed from accepting any `Element` to a specific kind of element: > generally, one of `PackageElement` or `TypeElement`. > > A new test is provided that checks that all the expected files are generated > for various kinds of nested classes and interfaces in all kinds of classes > and interfaces. The test is designed to fail if a new kind of class or > interface is added in future without a corresponding update to the test.
Jonathan Gibbons has updated the pull request incrementally with one additional commit since the last revision: address review comments ------------- Changes: - all: https://git.openjdk.java.net/jdk/pull/3821/files - new: https://git.openjdk.java.net/jdk/pull/3821/files/23940d05..39014cab Webrevs: - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3821&range=01 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3821&range=00-01 Stats: 12 lines in 1 file changed: 4 ins; 2 del; 6 mod Patch: https://git.openjdk.java.net/jdk/pull/3821.diff Fetch: git fetch https://git.openjdk.java.net/jdk pull/3821/head:pull/3821 PR: https://git.openjdk.java.net/jdk/pull/3821