Reputation: 133
I'm trying to get the line number of annotations from .class file, but I can get only the list of annotations, not the lines. Is it possible to do this?
Upvotes: 7
Views: 1252
Reputation: 21435
Looking through the Java Class File Specification it seems that for annotations no line number information is recorded.
Since the line number information is not present within the class file you cannot extract it from the class file.
Line numbers are only available for code segments: https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.7.12
Upvotes: 5