Git Product home page Git Product logo

Comments (6)

tsantalis avatar tsantalis commented on September 26, 2024 1

I first made an Eclipse Java project (File -> New -> Java Project) with the source code you provided.
Then in the Package Explorer view (Java Perspective), I selected both methods (by holding down Ctrl),
and right-clicked on them. A pop-up menu appears and you select "Refactor Duplicated code".

Alternatively, you can import results from NiCad or other clone detectors.
From the Bad Smells menu, click Duplicated Code to open the view.
The view has an import button (i) that opens the Import wizard.
Select the project in the Package Explorer and click on the import button.
In the wizard you should browse to the *-classes.xml file exported by NiCad
(for example _blocks-blind-clones-0.2-classes.xml)
After parsing the file, the clone groups will appear in the Duplicated code view.
You can scroll up/down to find the clone group corresponding to these methods.
Select the two clones in the group holding down Ctrl, right click, and then Refactor.

from jdeodorant.

tsantalis avatar tsantalis commented on September 26, 2024

Please report the project (repository or link to download) and the exact clone fragments you tried to refactor.

from jdeodorant.

prabh27 avatar prabh27 commented on September 26, 2024

Project -> https://github.com/prabh27/DuplicateCodeAntipattern1
Functions that are cloned are: shift, shift2.
NiCad detects the functions, but when I select both the clones and click on refactor, nothing happens. I am using a 64-bit Mac.

from jdeodorant.

tsantalis avatar tsantalis commented on September 26, 2024

You need to setup your code as an Eclipse Java project. It works fine. See screenshot below.

2016-08-10 09_06_22-extract clone

from jdeodorant.

prabh27 avatar prabh27 commented on September 26, 2024

Unable to do it. I followed the steps given in the video.
Could you please tell me the steps that you followed?

from jdeodorant.

dominicpp avatar dominicpp commented on September 26, 2024

old but gold. Thank you @tsantalis
I had the same issue.

from jdeodorant.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.