Description
Compiler version
Scala 3.0.0-M3
and 2.13.4
When cross compiling java.time
for Scala.js the following call site needs to be changed to Month.values
to compile with Scala 3.
https://github.com/ekrich/sjavatime/blob/master/sjavatime/shared/src/main/scala/java/time/LocalDate.scala#L408
When the code is compiled with 2.13.4
then it causes a warning because our Scala 2 implementation includes ()
:
[warn] /Users/eric/workspace/sjavatime/sjavatime/shared/src/main/scala/java/time/LocalDate.scala:408:23: Auto-application to `()` is deprecated. Supply the empty argument list `()` explicitly to invoke method values,
[warn] or remove the empty argument list from its definition (Java-defined methods are exempt).
[warn] In Scala 3, an unapplied method like this will be eta-expanded into a function.
[warn] val month = Month.values.takeWhile(_.firstDayOfYear(leap) <= dayOfYear).last
[warn] ^
[warn] two warnings found
Expectation
When defining Java APIs in Scala.js and Scala Native, we define empty parameter list methods with ()
. Since enum
can be used to write Java APIs and the values()
method is a Java API method, it should be defined with ()
s. Other applicable Java methods should also be changed to match.
As per Sébastien Doeraene @sjrd 07:22 on the Dotty gitter channel.
I agree. It would make sense to define with (). Please file an issue on GitHub.