Menu

#7 Add annotations to proxied class

open
nobody
None
5
2014-08-22
2008-11-10
Andy Kriger
No

When a class that has annotations or has methods with annotations is proxied, the annotations are not copied to the proxy class. This means that you cannot reflect on the annotations without adding proxy-checking/deproxying code to get the superclass (which then means you've cluttered your code with knowledge of proxies rather than the proxies remaining transparent). Even though it is the Java spec that annotations are not passed to subclasses, in this case, for a proxy to be truly transparent, it requires copying annotations. This can be controlled with a cglib configuration flag, inheritAnnotations=true/false.

Discussion