SpoonLabs / astor

Automatic program repair for Java with generate-and-validate techniques :v::v:: jGenProg (2014) - jMutRepair (2016) - jKali (2016) - DeepRepair (2017) - Cardumen (2018) - 3sfix (2018)
https://hal.archives-ouvertes.fr/hal-01321615/document
GNU General Public License v2.0
208 stars 106 forks source link

question:how to get variant that in ingredients or modifications #242

Closed ziqiboyaMeng closed 4 years ago

ziqiboyaMeng commented 4 years ago

Hi, Recently I was puzzled by a question,can I get variable that in ingredients or modifications? If yes, how to get it? Because my programming foundation is not good, it may be difficult for me to do this, could you give me some advises to solve this problem? Thanks, hope to hear from you soon. Greetings Meng

martinezmatias commented 4 years ago

Hi @ziqiboyaMeng

can I get variable that in ingredients or modifications?

I did not get what do you want to do. Could you detail a bit more? Thanks! Matias

ziqiboyaMeng commented 4 years ago

Thank you for your reply, I'm sorry I didn't make it clear. I want to get the variables or local variables defined in the method body where the modification point and material are located, and get the information such as the names or types of these variables.

martinezmatias commented 4 years ago

Hi @ziqiboyaMeng

Each modification point has a list with all variables that are in its context (local variables and class fields):

https://github.com/SpoonLabs/astor/blob/f0b58d8402055e58df4dca5862ae94637a02410a/src/main/java/fr/inria/astor/core/entities/ModificationPoint.java#L24

Is that info what you need? Regards Matias

ziqiboyaMeng commented 4 years ago

Yes, this is a variable related to the modification point, right? So how do I get the variables in the class (or method) where the material is, and there are no such variables(like you showed--- List) stored in the material properties? Thanks meng

martinezmatias commented 4 years ago

this is a variable related to the modification point, right?

Those are all variables in the scope of the modification point. In other words, those are all variables that can be acceded in that point (to write or read)

ziqiboyaMeng commented 4 years ago

Okay, I got what you mean, thank you very much for your help! Regards Meng