Closed
Description
Compiler version
3.3.1
Minimized code
// Hello.scala
object Hello extends App {
val service = MyService("fssdfs")
println("Works!")
}
// MyService.scala
class MyService(str: String)
compiles and runs fine.
But when you add a parameter to MyService
constructor, it still compiles but fails at runtime with NoSuchMethodError
.
Output
Exception in thread "main" java.lang.NoSuchMethodError: 'void example.MyService.<init>(java.lang.String)'
at example.Hello$.<clinit>(Hello.scala:5)
at example.Hello.main(Hello.scala)
Expectation
Code fails to compile.