I need to programmatically extract method definition/implementation from Java source file, could you recommend any handy library that I can use? Thanks.
Asked
Active
Viewed 922 times
4 Answers
1
if you look for a simple parser, i'd avise JavaParser (a much heavier implementation is also included in Eclipse)

Vincent Labatut
- 1,788
- 1
- 25
- 38
1
Before going nuts with libraries, have you considered if Doclets could fit for your purposes? While meant for custom Javadoc parsing, Doclets actually get access to a lot of details about the classes themselves which can be used for whatever purpose.
Another similar not-exactly-intended possibility is the rather badly documented Annotation Processor functionality which, despite its name, can be used for plain code generation and general messing around and about within whatever you're loading through the class loaders.

Esko
- 29,022
- 11
- 55
- 82