pouryafard75 / RM-ASTDiff

MIT License
2 stars 1 forks source link

Complex Cases #21

Open pouryafard75 opened 1 year ago

pouryafard75 commented 1 year ago
Dir: community/server/src/main/java/org/neo4j/server/security/ ssl/SslCertificateFactory.java ssl/Certificates.java

MultiMappings must be discussed. @tsantalis

Line 139 parent is already matched with Line 132 child. image

tsantalis commented 1 year ago

@pouryafard75 What is the issue here?

pouryafard75 commented 1 year ago

@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:

tsantalis commented 1 year ago
ensureFolderExists(certificatePath.getParentFile());
ensureFolderExists(privateKeyPath.getParentFile());

should match with

certificatePath.getParentFile().mkdirs();
privateKeyPath.getParentFile().mkdirs();
tsantalis commented 1 year ago

@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.

pouryafard75 commented 1 year ago

@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.

tsantalis commented 9 months ago

@pouryafard75 Case2 : L139 -> R132 is an exact match. Thus it should have higher priority than the inexact match L139 -> R140 The diff is correct.