Details
-
Type: Bug
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: 2.0
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:linux, openjdk 1.7.0_65
-
Number of attachments :
Description
I'm using this code to obtain packages annotation from a package and it always return an empty list:
javaField.getDeclaringClass().getPackage().getAnnotations()
I have a package-info.java file in the package that contain this:
@Anot package net.jcs.jboilerdowntest; import net.jcs.annotation.Anot;
A also tried this with the same result:
@net.jcs.annotation.Anot
package net.jcs.jboilerdowntest;
Activity
Robert Scholte
made changes -
Field | Original Value | New Value |
---|---|---|
Description |
I'm using this code to obtain packages annotation from a package and it always return an empty list:
javaField.getDeclaringClass().getPackage().getAnnotations() I have a package-info.java file in the package that contain this: @Anot package net.jcs.jboilerdowntest; import net.jcs.annotation.Anot; A also tried this with the same result: @net.jcs.annotation.Anot package net.jcs.jboilerdowntest; |
I'm using this code to obtain packages annotation from a package and it always return an empty list:
{{javaField.getDeclaringClass().getPackage().getAnnotations()}} I have a package-info.java file in the package that contain this: {code} @Anot package net.jcs.jboilerdowntest; import net.jcs.annotation.Anot; {code} A also tried this with the same result: {code} @net.jcs.annotation.Anot package net.jcs.jboilerdowntest; {code} |
This succeeds. Most important difference is that I don't search the package based on a field. The package of a JavaClass and of the package-info are two different instances, that's why you got an empty list. However, I see there is still some work to do here, because I can't get enough details of the Anot.