On Mon, 16 Oct 2023 05:02:01 GMT, Erik Gahlin <egah...@openjdk.org> wrote:
>> src/jdk.jfr/share/classes/jdk/jfr/internal/EventInstrumentation.java line >> 204: >> >>> 202: String typeDescriptor = classDesc.descriptorString(); >>> 203: for (ClassElement ce : classModel.elements()) { >>> 204: if (ce instanceof RuntimeVisibleAnnotationsAttribute rvaa) >>> { >> >> You can use >> `classModel.findAttribute(Attributes.RUNTIME_VISIBLE_ANNOTATIONS)` instead >> of looping. > > I could not get it to work with findAttribute. No annotations were found. The existing code will silently finish the loop no-op and return `null` if no RVAA is present. So if `findAttribute` returns `Optional.empty()`, you should just return `null` to match the old behavior. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16195#discussion_r1360143716