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
public classJavaTest {
public static void main(String[] args) {
MyClass<Integer> x =newMyClass<Integer>();
x.hello();
x.myVal();
}
}
The ScalaTest program works correctly:
$ scala ScalaTest
HELLO
The JavaTest program throws a NoSuchMethodError when run:
$ scala JavaTest
HELLO
java.lang.NoSuchMethodError: MyClass.myVal()LMyClass;
at JavaTest.main(JavaTest.java:5)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.util.ScalaClassLoader$$anonfun$run$1.apply(ScalaClassLoader.scala:78)
at scala.tools.nsc.util.ScalaClassLoader$class.asContext(ScalaClassLoader.scala:24)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.asContext(ScalaClassLoader.scala:88)
at scala.tools.nsc.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:78)
at scala.tools.nsc.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
at scala.tools.nsc.ObjectRunner$.run(ObjectRunner.scala:33)
at scala.tools.nsc.ObjectRunner$.runAndCatch(ObjectRunner.scala:40)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:56)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:80)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:89)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
The text was updated successfully, but these errors were encountered:
I ran into a NoSuchMethodError when trying to implement my own "implementation trait" code, patterned after TraversableLike.
The following Java and Scala code compiles without errors:
ScalaTest.scala:
JavaTest.java:
The ScalaTest program works correctly:
The JavaTest program throws a NoSuchMethodError when run:
The text was updated successfully, but these errors were encountered: