The fix for JDK-8256693 too often produces a ParameterizedType as the result of getAnnotatedReceiverType().getType() . A ParameterizedType is necessary only when this type or any of its transitive owner types has type parameters, but should be avoided if this isn't the case.
This implementation recursively creates a chain of ParameterizedTypes starting from the outermost type that has type parameters. See here for the now closed JDK 17 pr: https://github.com/openjdk/jdk/pull/1414 ------------- Commit messages: - Add javadoc note explaining empty type arguments array - 8256693: getAnnotatedReceiverType parameterizes types too eagerly Changes: https://git.openjdk.java.net/jdk16/pull/33/files Webrev: https://webrevs.openjdk.java.net/?repo=jdk16&pr=33&range=00 Issue: https://bugs.openjdk.java.net/browse/JDK-8256693 Stats: 133 lines in 4 files changed: 106 ins; 22 del; 5 mod Patch: https://git.openjdk.java.net/jdk16/pull/33.diff Fetch: git fetch https://git.openjdk.java.net/jdk16 pull/33/head:pull/33 PR: https://git.openjdk.java.net/jdk16/pull/33