Skip to content

Recursive Method Lookup (Java) #8062

Discussion options

You must be logged in to vote

Greetings, thanks for getting in touch with this question! Would something similar to the following (adapted to handle your specific use-case of beans rather than just any method) do what you need:

class NoArgMethod extends Method {
  NoArgMethod() { this.hasNoParameters() }

  NoArgMethod getNextStep() { result = this.getReturnType().(RefType).getAMethod() }

from NoArgMethod m1, NoArgMethod m2
where m1.getNextStep+() = m2
select m1.getName() + " calls " + m2.getName()

In particular, what this is doing is pulling out the logic of going one step further in the search into the getNextStep predicate. Then we can use the + operator to indicate that we want everything that is reachable in …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
Comment options

Answer selected by wdahlenburg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants