Duplicated code and project not compiling after refactoring Long Method.
Closed this issue · 4 comments
Project: Perseo-core (https://github.com/telefonicaid/perseo-core)
Commit: 19189b66cbb0ba97edad41147f749e3bb2d7d2fb
Package: src.main.java.org.json
Classname: JSONObject
Method: private void populateMap(Object bean)
Operating system: Linux Debian
Eclipse version: 2019-03 (4.11.0)
JDeodorant plug-in version: 5.0.70
When I perform Long Method refactoring from the JDeodorant Eclipse plug-in on the populateMap method, a block of code is duplicated in the extracted method. Because of this, a local variable is defined twice and the project contains compilation errors.
- Here the original code:
- Here the refactored code (the wrongly duplicated code is highlighted in blue):
It seems only B2 block (0/20) creates the problem you reported. For all other blocks the code is refactored correctly.
I still can replicate the issue when running JDeodorant over the entire project. However, when running JDeodorant over a single class (JSONObject) the refactoring is applied correctly.