Open GoogleCodeExporter opened 9 years ago
Let me know,does this behavior seem to be part of the specification?
Original comment by hiro0...@gmail.com
on 19 May 2007 at 1:14
This is not a problem of guice itself, but rather an issue of the underlying
proxy
creation libary cglib:
When you are intercepting method calls to objects, guice uses cglib to create a
proxy
for these objects. Cglib again subclasses the object's type and overrides all
non
final methods. So when you are calling object.getClass.getMethod() you are
actually
getting the method of the dynamically created subtype. As far as I have
followed the
cglib mailing list (http://osdir.com/ml/java.cglib.devel/2006-07/msg00006.html)
no
annotations will be copy from your concrete type to the created subtype for
backward
compability reasons (at least for cglib versions 2.x). Only type level
annotations
can be accessed from the subtype, if the annotation type is annotated with
@java.lang.annotation.Inherited
Simple workaround would look like calling
object.getClass.getSuperclass().getMethod(), which is indead dirty and
expensive.
Original comment by sven.lin...@gmail.com
on 2 Jun 2008 at 9:57
This was reported 2x, and issue 201 has more commentary. Closing as duplicate.
Original comment by limpbizkit
on 8 Jun 2008 at 11:28
Original issue reported on code.google.com by
hiro0...@gmail.com
on 6 May 2007 at 4:34Attachments: