google / google/guice

AOP classes don't get the annotations of the superclass

Open
#201 17 comments 0 reactions 0 assignees View on GitHub
bug Component-AOP imported Priority-Medium
Dominant language
Java
Stars
12.7k
Forks
1.7k
Avg merge
11m
Merged PRs (30d)
2

Description

_From [anthony.muller](https://code.google.com/u/112686044244068537059/) on May 30, 2008 05:41:03_

`@`ME :
I'm quite suprised... I annoted a method `@`MyAnnotation, in order to
intercept calls of this method. My problem is when I instanciate an object
which has a such annotation using guice. when i search the annoted method
through reflection, and i call isAnnotationPresent(MyAnnotation.class),
this method returns false!

`@`jesse`@`swank.ca: Under the hood, Guice creates a subclass of TotoImpl
in order to perform method interception.

For the most part, this is completely transparent to
the developer, but there's a few consequences. getClass()
doesn't return TotoImpl.class. This constraints how your
equals() method must be implemented.

I also expect Serializable won't interoperate with
method interception.

The workaround in this case is to use TotoImpl.class
rather than toto.getClass() to introspect on your
type.

_Original issue: http://code.google.com/p/google-guice/issues/detail?id=201_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.