Re: Need help with source code line number

Eugene Kuleshov <[email protected]>
Newsgroups gmane.comp.java.objectweb.asm
Message-ID <CADFjdoVuCHWPRpg_o=Crn2=-0QcXHQp9MXe8AemGsh6Aufd6hw@mail.gmail.com>
Jörgen,

  Generally it is just the first line number in the method body and
the last one. It would work more or less ok for regular methods, but
for constructors and instance and static initializers you'll have to
get more creative.

  regards,
  Eugene


On Mon, Sep 12, 2011 at 5:37 PM,  <[email protected]> wrote:
> Hi.
>
> I have a project where I want to map classes, the class' method signatures and
> method invokations within the class to the corresponding line numbers in the
> java source. Basically what I want to do is to build a library (db) where I can
> make lookups of type: who overrides this method, where is this method called
> from, etc.
>
> By extending ClassAdapter I find the method "properties" of the class and by
> extending Method adapter I can find method invocations and the line number
> where the method invokation took place.
> I can however not find a way to get the line numbers for the method itself.
> E.g. If I have a class like
> class Foo {
>  public String toString() {
>    return "foo".toUpperCase();
>  }
> }
> then I want to be able to somehow find out that the "public String toString()"
> starts on line 2 of the class and ends at line 4.
>
> Any ideas on what to do? I'm using ASM 3.3.1 (simply because I couldn't find
> 4RC2 in any maven repo).
>
> Best regards,
> Jörgen
>
> --
> You receive this message as a subscriber of the [email protected] mailing list.
> To unsubscribe: mailto:[email protected]
> For general help: mailto:[email protected]?subject=help
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>
message-footer.txt (text/plain, 238 B)
-- 
You receive this message as a subscriber of the [email protected] mailing list.
To unsubscribe: mailto:[email protected]
For general help: mailto:[email protected]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.