lundi 24 octobre 2016

How to get line numbers of a method?

Suppose we have following method:

1.  public static void main(String args[]) throws Exception {

2.    setUIFont(new javax.swing.plaf.FontUIResource("tahoma", Font.PLAIN, 12));
3.    new Frame();
4.    new Resource();
6.
7.    System.out.println(Integer.MAX_VALUE);
8.    }

As you can see, this method occupied lines 1 through 6. How can I get this list? Assume that I have the reflection class of this method.





Aucun commentaire:

Enregistrer un commentaire