ftomassetti / analyze-java-code-examples

Some examples of code extracting information from Java source files using JavaParser
99 stars 44 forks source link

Use of this examples in conjuntion with javasymbolsolver to filter specific variables delcarations. #1

Open TheTechOddBug opened 7 years ago

TheTechOddBug commented 7 years ago

Hi @ftomassetti ,

First of all, thank you very much for your explanations in your blog and your examples here. I'm trying to use JavaParser and JavaSymbolSolver to find all the declarations of variables belonging to specific classes (although project-defined ones) and I've started using this example and trying to combine with examples of JavaSymbolSolver in JavaSymbolSolverExamples, but using the build.gradle in this example and adding the dependency for JavaSymbolSolver found the build.gradle of that JavaSymbolSolver examples, I obtain one non-relevant error with node.getBeginLine() and node.getEndLine() methods. The important thing that I'm not able to solve is the use of ReflectionTypeSolver.

As I said before, I'm trying to find the way to search inside all code of one project to obtain all variables of one type. For example, finding all the variables of type javax.swing.JFrame. I would be grateful if you could help me.

ftomassetti commented 7 years ago

Hi, what I could do is to write a post on this subject in coming weeks. I should probably also release a new version of JavaSymbolSolver because the last version currently released works with an older version of JavaParser.

TheTechOddBug commented 7 years ago

Thank you very much for your answer. I'll review your new post when available. In the meantime, could you tell me which versions of the both libraries should I use and how can I include (if it is possible) ReflectionTypeSolver in my CombinedTypeSolver instance? Again, thank you very much in advance for your help and answers.