title: IntelliJ and built in Java Function Interface
body: <p>My Spring components implement java.util.function.Function. The idea behind this is to force a functional style with small encapsulated functions.</p>
  
  <pre><code>@Component
  public class MyFunction implements Function&lt;In, Out&gt; {
      public Out apply(In in) { .... }
  }
  
  // example usage
  @RestController
  public class MyApi {
      private MyFunction f;
      public void foo() {
          someList.stream()
              .map(f)
              . // whatever
      }
  }
  </code></pre>
  
  <p>Two problems arise with IntelliJ 2018.1:</p>
  
  <ul>
  <li>"Find Usages" offers a choice to find usages of the base method. If I accidentally hit "Yes", IntelliJ finds a zillion usages and slows down until it almost freezes. Well, I should definitely select "No" here, but it is still a small issue.</li>
  <li>Using the function in a Stream (e.g. filter) with "Method Reference" (as IntelliJ suggests) is even more problematic. Using "Find Usages" and selecting "No" will not show the "real" usage(s) im looking for. This makes it hard to navigate in the code.</li>
  </ul>
  
  <p>This leads me to my questions: Is it a good practice to use the built-in Function Interface or should I write my own Function without declaring it as a FunctionalInterface? Do you consider the mentioned problems as an IntelliJ bug? Are there workarounds you know of?</p>