The sonarqube version used is 7.7.
I am trying to create a custom rule for which I need the method signature. Currently using visitMethod() but not able to get the required output. The example below will help in understanding what I am trying to achieve.
I am trying to get the method signature till getAllEmpployees which i am not able to using visitMethod. please suggest how to do.
And also how to get the entire parameters including default value.
To answer your question, the method visitMethod(MethodTree tree) has a MethodTree as argument, you will find everything you need inside this object. I believe the method names of this object are clear enough, for example, you will find ResponseEntity<List<EmployeeEntity>> inside the returnType, and the annotation containing the default value inside the modifiers of the VariableTree. (that you can find inside FormalParameterList).
Feel free to get back to us if you still have questions.