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.ClassFormatError: Duplicate method name&signature in class file Playground$B$mcI$sp
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at Playground.main(Playground.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
The text was updated successfully, but these errors were encountered:
Marcin Mościcki (mmoscicki) said:
Oh, it seems it's slightly more serious, as simple override val instead of abstract override val is enough:
trait V[@specialized T] extends I[T] {
override val fun = m _
}
And simplified whole snippet:
trait I[@specialized T] {
def fun :T=>T
def m(value :T) :T
}
trait M[@specialized T] extends I[T]{
override def fun = m _
}
trait V[@specialized T] extends I[T] {
override val fun = m _
}
class B[@specialized T] extends I[T] with M[T] with V[T] {
override def m(value :T) = value
}
class C extends B[Int] {
override def m(value: Int): Int = value
}
val subject = new B[Int]
println(subject.fun(42))
Not sure if this construct should be supported or not, but in the latter case I guess the compiler should complain instead.
Produces
The text was updated successfully, but these errors were encountered: