IntelliJ IDEA 15 EAP Adds On-the-Fly Code Duplicates Detection

It’s been a while since we added the Analyze → Locate Duplicates feature. If you’ve had a chance to use it, you know how helpful it is: by eliminating duplicates in your code, you make it more concise and stable. If you’ve never used it, you definitely should; it’s truly surprising how many duplicates an average codebase usually contains.

The fresh IntelliJ IDEA 15 EAP build released today takes the duplicates analysis to an entirely new level by allowing you to spot them on-the-fly. Now, if you stumble upon an existing duplicate, or somehow create one either by writing or pasting code, you will know it instantly:


The analysis comes with quick-fixes, so you can navigate to duplicates or have them shown in a tool window:


The new inspection is called Duplicated Code and is enabled by default. To toggle it, go to SettingsEditor → Inspections. And, of course, you can run it on the entire project (or a custom scope) any time via Run Inspection by Name.

Note that this feature is currently available only for Java. As the work is still in progress, rare false positives are possible.  Don’t forget to report them as well as any other bugs to our tracker.

You’re welcome to download IntelliJ IDEA 15 EAP right away, give this new feature a try, and share your feedback.

Among other enhancements, you’ll find fixes for:

  • Big and blurry fonts and icons in the Editor on Linux
  • Not working Terminal on Windows 10

Develop with Pleasure!

Comments below can no longer be edited.

26 Responses to IntelliJ IDEA 15 EAP Adds On-the-Fly Code Duplicates Detection

  1. Avatar

    Oleg says:

    August 20, 2015

    Could you please add a way to configure this inspection similar to how you can configure “find duplicates” action from the menu? For example, I’d like to change “do not show duplicates smaller than” and “anonymize common subexpressions smaller than” parameters for it.

    • Avatar

      Maxim Mossienko says:

      September 2, 2015

      There are no such options at the moment

  2. Avatar

    Arteom Sedykh says:

    November 3, 2015

    I’ve just installed new IDEA 15.0, and I cant find Analyze → Locate Duplicates neither Settings → Editor → Inspections. What should I do to access these features?

  3. Avatar

    Lenny Krueger says:

    November 3, 2015

    just found the setting, it’s in File –>Settings –> Editor –> Inspections Once the Inspections menu opens, it’s under General –> Duplicated Code

  4. Avatar

    Gordon Child says:

    November 3, 2015

    Is there a way to disable code duplicates detection for tests? In some cases, I’d prefer to not abstract code when writing tests and don’t mind duplicate code.

  5. Avatar

    Bartosz Walacik says:

    November 3, 2015

    Is there a way to configure the threshold (now defaulted to 5 lines) when two code blocks are classified as duplicate?

    • Avatar

      Andrey Cheptsov says:

      November 3, 2015

      Right now there’s no way to configure it.

  6. Avatar

    David says:

    November 10, 2015

    Just downloaded Intellij15 and try to test this out, but when I go to File->Settings->Editor->Inspections and search for Duplicated Code I can’t seem to find it.

    Was this options moved?

  7. Avatar

    ILya says:

    November 10, 2015

    It would be convenient to have possibility to define exact methods, or method templates, for which duplicate detection will be disabled.

    For example hashCode, equals, toString methods are usually auto generated, and Idea often fires “duplication warning” in the places.

  8. Avatar

    Chris says:

    November 30, 2015

    1. Shows duplicates warning where duplicates do not exist. Alt+Enter>show duplicates like this: only one usage found
    2. Balloon shows message “Found duplicated code in module/src/main/java/com…” even when I press ctrl+F1. Showing just the class name/es would be more helpful.

    • Avatar

      Maksim Sobolevskiy says:

      December 1, 2015

      Hi, Chris! Could you provide more information about pint 1?
      Give us an example, please.

      • Avatar

        Chris says:

        December 1, 2015


        Not sure what kind of information could provide, given that this depends on the rest of the codebase, not the class in question.

        There is a method in one of my classes where all lines of the body are marked as duplicate.

        When I Alt+Enter>show duplicates like this: I get “only one usage found” and the body of the method is highlighted.
        I did search in the hole project for parts of the method but didn’t find any other occurrences.

        It would be helpful if I was given the class name instead of the beginning of it’s path in the balloon.

        • Avatar

          Vasiliy says:

          November 16, 2017

          I have the same problem. IDEA tells me “Found duplicated code in this file”, but “View duplicates like this” results in “Only one usage found”.

  9. Avatar

    Brooke says:

    June 3, 2016

    This is a great feature. Though I find it gets in the way sometimes and I’d like to change from showing a squiggly line under every line to just the first (or similar). For example I’ve copied code from another dev with the intention to refactor for my purposes though I want to read through it first to understand the changes I need to make. The squiggles everywhere is a bit like someone shouting at me! I don’t want to turn off the feature nor suppress it. I’d just like it to collapse temporarily (until file is closed or committed).

  10. Avatar

    Zsolti says:

    August 9, 2016

    Can I suppress the duplicate code marking for just one particular occurrence?

  11. Avatar

    Cuero Qu says:

    September 7, 2016

    Find an example of ‘Show duplicate warning but actually it’s not duplicate’. Here’s the code:
    method test and test2 are reported as duplicates code, while the parameters to inner class Test are different.

    public class TestMain {
    int anInt = 1;
    public void test(int a)
    TestMain testMain = new TestMain();
    new Test(testMain::test);

    public void test2(int a)
    TestMain testMain = new TestMain();
    new Test(testMain::test2);

    public class Test {
    Test(handler h) {


    public interface handler {
    void entitySelector(int a);

  12. Avatar

    Slava Tyryshkin says:

    June 25, 2020

    hello guys
    thank you so much for this new feature

    could you please show some scientific papers or internal logic of this algorithm?

Discover more