Open pouryafard75 opened 1 year ago
@pouryafard75 What is the issue here?
@tsantalis
For the case 1:
Inline Method Refactoring private ensureFolderExists(path File)
: void is reported and the bodyMapper is also correct but the statement containing method invocation call is not matched. In other words, the following statements can also be mapped:
ensureFolderExists(certificatePath.getParentFile());
ensureFolderExists(privateKeyPath.getParentFile());
should match with
certificatePath.getParentFile().mkdirs();
privateKeyPath.getParentFile().mkdirs();
@pouryafard75 In case of duplicate mappings, as in case 1 we have a rule to discard the mappings involving a call to extracted or inlined method.
So, in this case the mappings shown in https://github.com/pouryafard75/RM-ASTDiff/issues/21#issuecomment-1418240311 will be discarded.
However, what we need is a sub-expression mapping between the expression passed as argument, which then becomes the expression used to call mkdirs()
We can generate these sub-expression mappings directly in the Extract/Inline Method refactoring objects, without making mappings at statement level.
@tsantalis For case 2, the mappings are correct in my opinion. Let me know if you disagree. I will add it to the test cases.
@pouryafard75 Case2 : L139 -> R132 is an exact match. Thus it should have higher priority than the inexact match L139 -> R140 The diff is correct.
MultiMappings must be discussed. @tsantalis
checkForTestRoots
. @tsantalis Should we match Line 139 parent committestFolders.addAll(ModuleRootManager.getInstance(srcModule).getSourceRoots(JavaSourceRootType.TEST_SOURCE));
with Line 140 child committestFolders.addAll(ModuleRootManager.getInstance(module).getSourceRoots(JavaSourceRootType.TEST_SOURCE));
?Line 139 parent is already matched with Line 132 child.