JDK-8200205 : Method.getAnnotations fails to find annotations under certain circumstances
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang:reflect
  • Affected Version: 8
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2018-03-25
  • Updated: 2018-05-16
  • Resolved: 2018-05-16
Related Reports
Duplicate :  
If Bar extends Foo, and Foo is package protected, then Method.getAnnotations() fails to find the annotations on public methods defined on Foo.
However, it does work if you inspect the annotations on Foo directly. The combination of a sub-class, and package protected abstract parent class, causes the issue.
The reported issue has been resolved in JDK by the following enhancement - JDK-6695379 The issue was reproducible on latest JDKs since the test classes have been compiled with old java version, i.e. version prior to jdk8 b94.

I think this was assigned to hotspot/compiler by mistake (because I don't see how this could be a JIT issue). Moving to core-libs/java.lang:reflect.