How to get line number of method in Interface #2949
-
|
I need to analyze method in Interface, when create a new BugInstance and addSourceLine,there is no source line data in org.apache.bcel.classfile.Method object. Is There any way to solve this problem, Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Thanks for opening your first issue here! 😃 |
Beta Was this translation helpful? Give feedback.
-
|
I'm sorry for the belated answer. If you are writing a detector, you can get the sourceline data from the instruction, the pc, or the visitor itself. I suggest you to take a look at the usages of the |
Beta Was this translation helpful? Give feedback.
I'm sorry for the belated answer. If you are writing a detector, you can get the sourceline data from the instruction, the pc, or the visitor itself. I suggest you to take a look at the usages of the
BugInstance.addSourceLine()functions in the SpotBugs code, especially in the detectors which are in the edu.umd.cs.findbugs.detect package.If you want to refer the entire method, not a specific line, you can use one of the SourceLineAnnotation.forEntireMethod() methods.