You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A class compiled with Java lacks default constructor. The Scala compiler nevertheless accepts constructor calls without parameter. The Java compiler correctly fails to compile such calls.
Unpack the attached tarball, put the desired versions of javac and scalac on PATH, cd into no_default_constructor_bug and execute ./runme.sh. If the script fails, the bug was triggered.
When I discovered the problem in a real application setting, the scala compiler generated some byte code that brought down the JVM.
The text was updated successfully, but these errors were encountered:
@retronym said:
Unfortunately, this is a "feature" known as automatic argument list tupling. The lack of safety is discussed in #3583.
I recommend compiling with -Yno-adapted-args or at least -Ywarn-adapted-args. The latter is part of the option set -Xlint`.
src/main/scala/com/foo/TimeSlot.scala:9: warning: No automatic adaptation here: use explicit parentheses.
signature: Interval(x$1: Any): org.joda.time.Interval
given arguments: <none>
after adaptation: new Interval((): Unit)
val nullSlot = new TimeSlot(new Interval())
^
src/main/scala/com/foo/TimeSlot.scala:9: error: not enough arguments for constructor Interval: (x$1: Any)org.joda.time.Interval.
Unspecified value parameter x$1.
val nullSlot = new TimeSlot(new Interval())
^
A class compiled with Java lacks default constructor. The Scala compiler nevertheless accepts constructor calls without parameter. The Java compiler correctly fails to compile such calls.
Unpack the attached tarball, put the desired versions of javac and scalac on PATH, cd into no_default_constructor_bug and execute ./runme.sh. If the script fails, the bug was triggered.
When I discovered the problem in a real application setting, the scala compiler generated some byte code that brought down the JVM.
The text was updated successfully, but these errors were encountered: