Closed santos-samuel closed 4 years ago
calleeLocation.getExecutable().getExecutableDeclaration() but this returns "null" and I can't understand why.
Seems like a bug. Would you make a PR with a failing test case? That would be super useful. Thanks!
Should I make a guide on how to reproduce the error? I have my SpoonCallGraph.java class and I am analysing the code that belongs to another repository (https://github.com/socialsoftware/edition/tree/master/edition-ldod)
A failing test case in a PR is much more productive than a guide.
I already created a test case. I switched to a new branch but I believe I don't have permissions to commit and create a pull request...
great. you have to first fork the repo, push the branch in your fork, and create the PR from there.
Hello, I have a doubt about Spoon.
I am using Spoon to construct a CallGraph of some classes belonging to a project folder. I am iterating over the classes/methods and following a DFS approach.
To start, I am giving a folder as input like shown:
This folder has a lot of classes, which includes:
By giving the whole folder as input to the launcher, I believe both of these classes will belong to the model (
launcher.buildModel();
).So, I want to construct a callgraph of a method
changePassword
of theUserController
class:To do that, I retrieve all the CtAbstractInvocation Elements of this method.
method.getElements(new TypeFilter<>(CtAbstractInvocation.class))
At some point I have a
CtAbstractInvocation
variable (calleeLocation
) that represents the linevalidator.validate(form, formBinding);
(which is in runtime aCtInvocationImpl
).Then, to add the method that is accessed in this line to a list I try to do:
calleeLocation.getExecutable().getExecutableDeclaration()
but this returns "null" and I can't understand why.I believe the
getExecutableDeclaration()
should return the method that is being called and that is known because is present in the list of classes provided to the model. (For instance:launcher.getFactory().Class().getAll()
shows theChangePasswordValidator
class.)Method being called below:
Can someone explain me why this is happening?
Thanks in advance!