On Mon, 17 Jan 2022 08:28:35 GMT, Erik Gahlin <egah...@openjdk.org> wrote:
>> src/jdk.jfr/share/classes/jdk/jfr/internal/TypeLibrary.java line 405: >> >>> 403: Object res = m.invoke(a, new Object[0]); >>> 404: if (res instanceof Annotation[]) { >>> 405: for (Annotation rep : (Annotation[]) >>> m.invoke(a, new Object[0])) { >> >> BTW it looks suspicious to have `m.invoke(a, new Object[0])` called again >> here. Shouldn't it just reuse `res` variable instead? > > It looks unnecessary. Please feel free to fix. Or even use the new pattern matching syntax and remove unnecessary explicit empty array construction: if (m.invoke(a) instanceof Annotation[] anns) { for (Annotation rep : anns) { ------------- PR: https://git.openjdk.java.net/jdk/pull/7061