• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to count number of lines inside methods() using the Doclet API

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wrote a custom doclet using the Doclet API (located inside the tools.jar).

The purpose for the doclet is to load Java source files and create stubs (which are identical Java source files but do not contain any method implementation details).

Instead, the method implementation details need to be replaced with blank lines...



As one can see, I am just creating the method and placing the opening and closing curly braces (along with a new \n line escape sequence, in between).

Am not really that familiar with the Doclet API...

Question(s):

(1) What is the best way to figure out how many lines of code are inside each method and then use a for loop to insert the exact same number of blank lines inside the methods?

(2) Is there a way to do it using the com.sun.javadoc.SourcePosition.line() method?

Would really appreciate it if someone could assist me by suggesting possible workarounds / solutions, because this is an important and urgent requirement.

Happy coding to all,

Mike
[ July 22, 2008: Message edited by: Michael K. Wilson ]
reply
    Bookmark Topic Watch Topic
  • New Topic