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
Exception in thread "main" java.lang.NoSuchMethodException:Baz$Bar.<init>(Baz)
at java.lang.Class.getConstructor0(Class.java:2902)
at java.lang.Class.getDeclaredConstructor(Class.java:2066)
at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$constructorToJava$1.apply(JavaMirrors.scala:1287)
at scala.reflect.runtime.JavaMirrors$JavaMirror$$anonfun$constructorToJava$1.apply(JavaMirrors.scala:1281)
at scala.reflect.runtime.TwoWayCaches$TwoWayCache$$anonfun$toJava$1.apply(TwoWayCaches.scala:50)
at scala.reflect.runtime.Gil$class.gilSynchronized(Gil.scala:19)
at scala.reflect.runtime.JavaUniverse.gilSynchronized(JavaUniverse.scala:16)
at scala.reflect.runtime.TwoWayCaches$TwoWayCache.toJava(TwoWayCaches.scala:45)
at scala.reflect.runtime.JavaMirrors$JavaMirror.constructorToJava(JavaMirrors.scala:1281)
at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaMethodMirror.jconstr$lzycompute(JavaMirrors.scala:332)
at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaMethodMirror.jconstr(JavaMirrors.scala:332)
at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaVanillaMethodMirror0.jinvokeraw(JavaMirrors.scala:365)
at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaMethodMirror.jinvoke(JavaMirrors.scala:339)
at scala.reflect.runtime.JavaMirrors$JavaMirror$JavaVanillaMethodMirror.apply(JavaMirrors.scala:355)
at Foo$.main(Foo.scala:17)
at Foo.main(Foo.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
The reason is that the Bar constructor takes Baz1 as the first argument instead of Baz.
Removing the self-type makes it work, but isn't an acceptable workaround in my case.
The text was updated successfully, but these errors were encountered:
Running this code
throws an exception:
The reason is that the
Bar
constructor takesBaz1
as the first argument instead ofBaz
.Removing the self-type makes it work, but isn't an acceptable workaround in my case.
The text was updated successfully, but these errors were encountered: