I am trying to search a specific string in the source code so that I can identify the string is found in which method.I tried file reader. But failed . How to identify a method and it's scope while reading a source code with a file reader? Is there any other way to get the method and it's scope / method and it's declaration?
I took another approach where I could manage to get name of methods of the file using classloader. But again failed to get the method declaration.
Any help will be appreciated. TIA.
EDIT: I have posted my Source Code in another answer. These are just some technical errors that can go unchecked. But it's not really important now.
The problem with identifying the method the keyword is in is:
1) It might be in a constructor,
2) It might be a member variable,
3) It might be in a loop or a condition,
4) Or it might even be in an Overriden method of the initially executed method.
The easiest way is to print the location (Like an address). Example:
Location: if(a!=0), if(a < 500), main(String[] args), class FUBARYou can use a recursive method with a regex which identifies everything within braces, and searches for the keyword. I can post the entire code in 4-5 hours, if that's fine.