Is there a specific reason why you want to create a parser yourself? IMO, it would be easier to let an existing parser create an AST for you, which you just go through to collect your data about the source file (s). Using your favorite search engine with the keywords "get ast java source" will result in many relevant queries.
At first glance, they look like suitable candidates:
Of course, you can use ANTLR, there are many ANTLR grammars for Java available to you, but when choosing this option, a learning curve tool (or some other parser generator, for that matter) is enough. If you choose ANTLR, I am more than happy to answer any questions regarding this.
Good luck
source share