Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to judge if the name and body become stable after a change #34

Open
lzl-cmd opened this issue Oct 12, 2022 · 4 comments
Open

How to judge if the name and body become stable after a change #34

lzl-cmd opened this issue Oct 12, 2022 · 4 comments

Comments

@lzl-cmd
Copy link

lzl-cmd commented Oct 12, 2022

Hi Kui,

I am one of your fans. Thanks for your great work! Recently I am performing a project based on your work. I have a question that needs your help.

In your paper, you introduced that a renamed method name would be collected if (1) the method body is not changed, and (2) the method name and body become stable after the change.

After reading the code, I find that the first condition is ensured by the following line

if (!methodBodyChanged(actionSet, delActionSets, insActionSets)) {

but I did not find the corresponding code towards the second condition. I would appreciate it if you could give me some clues. Thanks in advance!

@Kui-Liu
Copy link
Member

Kui-Liu commented Oct 13, 2022

Hello @lzl-cmd , Thanks for your interests in our work.
For the first condition, it can be done by your mentioned code, which will collect the modified method names from all commits, where we will collect the method signature for each collected method.
A method might be changed multiple times.
So, with the method signatures, we can identify whether a collectted modified method was modified multiple times or not.
If a collected method method modified times, we will consider the one modified in the latest time, others will be discarded.

@lzl-cmd
Copy link
Author

lzl-cmd commented Oct 13, 2022

Thanks for your replying! With the help of your hint, I found these



if (child.getActionString().startsWith("UPD SimpleName@@MethodName:")) {

But I'm still not sure whether these three judgements can finish the job. Could you show me more details?
Thanks in advance!

@Kui-Liu
Copy link
Member

Kui-Liu commented Oct 14, 2022

I didn't touch the code for a long time, I do not remember so many details any more. I am sorry for that.
I am sure that, if you execute the RenameMethodsCollector, all judgements will be finished to collect the correct data.

@lzl-cmd
Copy link
Author

lzl-cmd commented Oct 21, 2022

NewMethodNames.txt
OldMethodNames.txt

I run the RenamedMethodsCollector with the first repository(abdera), and get the above results, I find that the first two method renames are quite similar:
image
image

so I print the commit's path out and find the concrete commits in the 1.Data/Output/Commit_Diffs/abdera/revFiles/fa61c6_108201_server#src#main#java#org#apache#abdera#server#AbderaServerException.java
2.Data/Output/Commit_Diffs/abdera/prevFile/prev_fa61c6_108201_server#src#main#java#org#apache#abdera#server#AbderaServerException.java
3.Data/Output/Commit_Diffs/abdera/revFiles/108201_1c6007_server#src#main#java#org#apache#abdera#server#AbderaServerException.java
4.Data/Output/Commit_Diffs/abdera/prevFile/prev_108201_1c6007_server#src#main#java#org#apache#abdera#server#AbderaServerException.java

fa61c6_108201_server#src#main#java#org#apache#abdera#server#AbderaServerException.txt
prev_108201_1c6007_server#src#main#java#org#apache#abdera#server#AbderaServerException.txt
prev_fa61c6_108201_server#src#main#java#org#apache#abdera#server#AbderaServerException.txt
108201_1c6007_server#src#main#java#org#apache#abdera#server#AbderaServerException.txt

From the commits' history, I guess that the original commit is 1c6007, after which the method:

public boolean hasEntity() { return false; }
which was changed in the commit 108201 into:
public boolean hasOutput() { return false; }
.
And this method was changed from hasOutput to hasEntity again in the commit fa61c6:
public boolean hasEntity() { return false; }

But from the commit changes I found, the filter seems to fail in getting the renamed methods that are stable after changing.
I would highly appreciate it if you could help me check this case. Thanks in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants