Annotation's parameter which type is short, it's value in AnnotationInfo is always 0.
@Retention(RetentionPolicy.CLASS)
@Target(ElementType.TYPE)
public @interface MyAnnotation {
short value();
}
@MyAnnotation(1)
public class MyClass {
public static void main(String[] args) {
new ClassGraph()
.enableAllInfo()
.scan(ForkJoinPool.commonPool(), 8)
.getClassesWithAnnotation(MyAnnotation.class.getName())
.forEach(classInfo -> {
AnnotationInfo annotationInfo = classInfo.getAnnotationInfo(MyAnnotation.class.getName());
Object value = annotationInfo.getParameterValues().get("value").getValue();
System.out.println(value); // prints: 0
});
}
}
I beleive the short type value is handled incorrectly at return (short) cpReadUnsignedShort(reader.readUnsignedShort());
And I tried cpReadInt instead of cpReadUnsignedShort, it works fine.
Annotation's parameter which type is
short, it's value inAnnotationInfois always0.I beleive the
shorttype value is handled incorrectly at return (short) cpReadUnsignedShort(reader.readUnsignedShort());And I tried
cpReadIntinstead ofcpReadUnsignedShort, it works fine.