Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to get the line number of annotations from .class file?

Tags:

java

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?

like image 428
Domenica Avatar asked Jan 11 '19 08:01

Domenica


1 Answers

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

like image 118
Thomas Kläger Avatar answered Oct 30 '22 12:10

Thomas Kläger