RefactoringMiner icon indicating copy to clipboard operation
RefactoringMiner copied to clipboard

Replacement Inaccuracy

Open pedramnoori opened this issue 2 years ago • 0 comments

Problem

Replacement inaccuracy within four Extract and Move Method refactorings

Commit

https://github.com/bitcoinj/bitcoinj/commit/12602650ce99f34cb530fc24266c23e39733b0bb

Refactorings

1- Extract And Move Method public getSerializer(parseLazy boolean, parseRetain boolean) : BitcoinSerializer extracted from public testLazyParsing() : void in class org.bitcoinj.core.BitcoinSerializerTest & moved to class org.bitcoinj.params.AbstractBitcoinNetParams

2- Extract And Move Method public getSerializer(parseLazy boolean, parseRetain boolean) : BitcoinSerializer extracted from private testCachedParsing(lazy boolean) : void in class org.bitcoinj.core.BitcoinSerializerTest & moved to class org.bitcoinj.params.AbstractBitcoinNetParams

3- Extract And Move Method public getSerializer(parseLazy boolean, parseRetain boolean) : BitcoinSerializer extracted from public testBlock(blockBytes byte[], isChild boolean, lazy boolean, retain boolean) : void in class org.bitcoinj.core.LazyParseByteCacheTest & moved to class org.bitcoinj.params.AbstractBitcoinNetParams

4- Extract And Move Method public getSerializer(parseLazy boolean, parseRetain boolean) : BitcoinSerializer extracted from public testTransaction(params NetworkParameters, txBytes byte[], isChild boolean, lazy boolean, retain boolean) : void in class org.bitcoinj.core.LazyParseByteCacheTest & moved to class org.bitcoinj.params.AbstractBitcoinNetParams

Description

There is one similar statement mapping within the aforementioned refactorings, which is as follows:

BitcoinSerializer bs=new BitcoinSerializer(MainNetParams.get(),true,false); Mapped with: return new BitcoinSerializer(this,parseLazy,parseRetain);

There should be three replacements about the BitconSerializer constructor's arguments corresponding the above mentioned mapping. But, RefactoringMiner reported inaccurate replacements, which caused PurityChecker fail to report this change as a pure modification. The reported inaccurate replacements by RefactoringMiner are as follows:

replacements

pedramnoori avatar May 08 '23 17:05 pedramnoori