Skip to content

Processing SAM with overridden methods of java.lang.Object fails #7359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
neshkeev opened this issue Oct 3, 2019 · 0 comments
Closed

Processing SAM with overridden methods of java.lang.Object fails #7359

neshkeev opened this issue Oct 3, 2019 · 0 comments

Comments

@neshkeev
Copy link
Contributor

neshkeev commented Oct 3, 2019

Dotty fails to process @FunctionalInterface objects when they contain overridden public methods of java.lang.Object, but javadoc states:

If an interface declares an abstract method overriding one of the public methods of java.lang.Object, that also does not count toward the interface's abstract method count

minimized code

val comp : java.util.Comparator[Int] = (x, y) => -1
println(comp.compare(1,2))

fails with

-- [E081] Syntax Error: MySam.scala:10:46 --------------------------------------
10 |      val comp : java.util.Comparator[Int] = (x, y) => -1
   |                                              ^
   |                          Missing parameter type
   |                          
   |                          I could not infer the type of the parameter x.
-- [E081] Syntax Error: MySam.scala:10:49 --------------------------------------
10 |      val comp : java.util.Comparator[Int] = (x, y) => -1
   |                                                 ^
   |                          Missing parameter type
   |                          
   |                          I could not infer the type of the parameter y.
two errors found

expectation

The code above should print -1 to the standard output.

@neshkeev neshkeev changed the title Processing of SAM with overridden methods of java.lang.Object fails Processing SAM with overridden methods of java.lang.Object fails Oct 3, 2019
smarter added a commit that referenced this issue Nov 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant