Fixing some issues with runtime annotations within avian.

We were not properly converting dots to slashes internally for package names
and we did not properly handle Method.getAnnotations and
Method.getAnnotation(Class<T>) on methods without any annotations.

Added some tests to cover these cases.
This commit is contained in:
Mike Keesey
2012-05-22 14:00:31 -06:00
parent 0addd8c814
commit a5c9dd6f24
9 changed files with 55 additions and 25 deletions

View File

@ -170,7 +170,7 @@ public class Method<T> extends AccessibleObject implements Member {
}
public <T extends Annotation> T getAnnotation(Class<T> class_) {
if (vmMethod.addendum.annotationTable != null) {
if (vmMethod.hasAnnotations()) {
Object[] table = (Object[]) vmMethod.addendum.annotationTable;
for (int i = 0; i < table.length; ++i) {
Object[] a = (Object[]) table[i];
@ -183,7 +183,7 @@ public class Method<T> extends AccessibleObject implements Member {
}
public Annotation[] getAnnotations() {
if (vmMethod.addendum.annotationTable != null) {
if (vmMethod.hasAnnotations()) {
Object[] table = (Object[]) vmMethod.addendum.annotationTable;
Annotation[] array = new Annotation[table.length];
for (int i = 0; i < table.length; ++i) {