title: Cannot compile method reference in JDK 11
body: <p>I am currently migrating a project to JDK 11 and compiling it with Maven. However, Maven throws a wobbly over a single method reference (it doesn't have issues elsewhere). The method in question looks like this:</p>
  
  <pre><code>public class MyThing {
  
      boolean something = true;
  
      // ...
  
      public boolean isSomething() {
          return something;
      }
  
      // ...
  }
  </code></pre>
  
  <p>And the call to the above method looks more or less like this:</p>
  
  <pre><code>return methodThatGetsOptionalDefinition(aString)                 // Optional&lt;Definition&gt;
          .map(definition -&gt; defenition.getMyThing(anotherString)) // Optional&lt;MyThing&gt;
          .map(MyThing::isSomething)                               // Optional&lt;Boolean&gt;
          .orElse(true);
  </code></pre>
  
  <p>Compiling this, Maven throws the following message:</p>
  
  <pre><code>&gt; mvn clean install -Pdist-snapshot -DskipTests
  [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project XXXXX: Compilation failure
  [ERROR] /D:/XXXXX.java:[63,38] incompatible types: invalid method reference
  [ERROR]     method isSomething in class XXXXX.MyThing cannot be applied to given types
  [ERROR]       required: no arguments
  [ERROR]       found: java.lang.Object
  [ERROR]       reason: actual and formal argument lists differ in length
  [ERROR]
  [ERROR] -&gt; [Help 1]
  [ERROR]
  [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
  [ERROR] Re-run Maven using the -X switch to enable full debug logging.
  </code></pre>
  
  <p>If I expand the method reference like so, it compiles without a problem:</p>
  
  <pre><code>return methodThatGetsOptionalDefinition(aString)
          .map(definition -&gt; defenition.getMyThing(anotherString))
          .map(myThing -&gt; myThing.isSomething())
          .orElse(true);
  </code></pre>
  
  <p>Typing the Optional also works:</p>
  
  <pre><code>return methodThatGetsOptionalDefinition(aString)
          .&lt;MyThing&gt;map(definition -&gt; defenition.getMyThing(anotherString))
          .map(myThing -&gt; myThing.isSomething())
          .orElse(true);
  </code></pre>
  
  <p>The same error occurs when compiling the project using IntelliJ with both Open JDK versions 11.0.1 and 11.0.2. Ironically, IntelliJ complains that the "Lambda can be replaced with method reference". The problem also occurs when using a different "language mode".</p>
  
  <pre><code>&lt;plugin&gt;
      &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
      &lt;configuration&gt;
          &lt;source&gt;11&lt;/source&gt;
          &lt;target&gt;11&lt;/target&gt;
      &lt;/configuration&gt;
  &lt;/plugin&gt;
  </code></pre>
  
  <p>Does anyone have any idea why this might be happening?</p>
  
  <p><em>Some of the specific implementation details have been obfuscated.</em></p>