title: Code duplication anaysis in IntelliJ and source generation
body: <p>I have three Java classes that implement an <code>Iterable</code> interface. Two of them have the exact same implementation for their <code>iterator()</code> methods, which causes IntelliJ to flag the code as duplicated.</p>
  
  <p><a href="https://i.stack.imgur.com/xwOPp.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xwOPp.png" alt="The code duplication soft warning yielded by IntelliJ"></a></p>
  
  <p>Since I'm using Java 8, I could push the implementation as a "default" at the level of the interface, but that would require also adding private fields on the interface which really gives out more information than is necessary, even if it were possible (I'm new to Java 8 so I'm not sure whether Java 8 also allows you to declare or even initialize fields at the level of the interface). Even if I were to do that, there will be more classes implementing the common interface with different implementations for <code>iterator()</code>.</p>
  
  <p>I have found <a href="https://www.jetbrains.com/help/idea/2016.3/analyzing-duplicates.html#dup" rel="nofollow noreferrer">this link</a> towards the IntelliJ documentation that says the following:</p>
  
  <blockquote>
    <p>To do that, select the check box <strong>Ignore duplicated code in sources marked as generated</strong> in the inspection settings page:[...]</p>
  </blockquote>
  
  <p>Unfortunately, despite the fact that this checkbox does indeed appear in my inspection settings page:</p>
  
  <p><a href="https://i.stack.imgur.com/mfYpr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mfYpr.png" alt="enter image description here"></a></p>
  
  <p>The problem still persists after checking that checkbox. I'm not entirely sure what "generated sources" means in the link that I posted above and I'm looking for some assistance.</p>
  
  <p>For what it's worth, I'm running IntelliJ 2017.1 Ultimate Edition.</p>