Why does method reference needs a type casting to a Function interface?
<p>In this code snippet my IDE <em>(IDEA Intellij Community)</em>  suggesting to cast method reference to Function Interface. </p>

<p>Why is that ? </p>

<pre><code> public class MethodReferences {

    public static void main(String[] strings) {
        Function&lt;String, Integer&gt; f = Integer::parseInt;

        Predicate&lt;Person&gt; personPredicate = p-&gt;convert(p.getAge(),Integer::parseInt) &gt;10;

        //This is fine 
        System.out.println(convert("123", f));

        //This is fine
        System.out.println(convert("123", (Function&lt;String, Integer&gt;) Integer::parseInt));

        //This is NOT
        System.out.println(convert("123", Integer::parseInt)); //x1
    }

    private static &lt;T, S&gt; T convert(S s, Function&lt;S, T&gt; stFunction) {
        return stFunction.apply(s);
    }
}
</code></pre>

<p>The Error message I get in line <code>x1</code> is:</p>

<pre><code>Error:(20, 19) java: reference to println is ambiguous
  both method println(char[]) in java.io.PrintStream and method println(java.lang.String) in java.io.PrintStream match

Error:(20, 35) java: incompatible types: inferred type does not conform to upper bound(s)
    inferred: java.lang.Integer
    upper bound(s): char[],java.lang.Object
</code></pre>