Ambiguity method error when one method can't be applicable
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Fri Oct 11 14:26:59 PDT 2013
Hi Anna,
Thanks for the detailed report, we will look at it and get back to you
later.
Vicente
On 09/10/13 13:28, Anna Kozlova wrote:
> Hi,
>
> It looks like that the change which caused the problem is
> http://hg.openjdk.java.net/lambda/lambda/langtools/rev/4a6acc42c3a1. The
> test data e.g.
> http://hg.openjdk.java.net/lambda/lambda/langtools/file/4a6acc42c3a1/test/to
> ols/javac/lambda/TargetType02.java was changed exactly in a way I've
> described.
>
> The change itself is quite complicated and javac specific so I am not sure I
> understand how it is connected to the spec. Could you please help?
>
> Thank you
> Anna Kozlova
> JetBrains
> http://www.jetbrains.com
> "Develop with pleasure!"
>
>
>
> -----Original Message-----
> From: lambda-dev-bounces at openjdk.java.net
> [mailto:lambda-dev-bounces at openjdk.java.net] On Behalf Of Anna Kozlova
> Sent: Tuesday, October 08, 2013 5:53 PM
> To: lambda-dev at openjdk.java.net
> Subject: Ambiguity method error when one method can't be applicable
>
> Hi guys,
>
>
>
> The following code does not compile with ambiguous method error:
>
>
>
> class MyTest {
>
>
>
> interface I1 {
>
> Foo<Number> m(String s);
>
> }
>
>
>
> interface I2 {
>
> Foo<Number> m(Integer i);
>
> }
>
>
>
> static class Foo<T extends Number> {
>
> Foo(T t) {
>
> System.out.println(t);
>
> }
>
> }
>
>
>
> private static void m(I1 i) {}
>
> private static void m(I2 i) {}
>
>
>
> public static void main(String[] args) {
>
> m(Foo::new);
>
> }
>
> }
>
>
>
> Some time ago though there was no such an error.
>
>
>
> Not sure that I understand why compiler can't resolve such an ambiguity for
> me. Could someone explain, please?
>
>
>
> Thank you
> Anna Kozlova
> JetBrains
> <http://www.intellij.com/> http://www.jetbrains.com "Develop with
> pleasure!"
>
>
>
>
>
> !DSPAM:35,52542aaf317841350320123!
>
>
More information about the lambda-dev
mailing list