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
importscala.annotation.staticclassC {
vala:Int=3classDobjectD {
@static deffoo:Int= a * a
}
}
@main
defTest=valc=newC
println(c.D.foo)
Output
java.lang.NoSuchFieldError:MODULE$
at C$D.foo(main.scala:7)
at main$package$.Test(main.scala:14)
at Test.main(main.scala:11)
at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)
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 sbt.Run.invokeMain(Run.scala:115)
at sbt.Run.execute$1(Run.scala:79)
at sbt.Run.$anonfun$runWithLoader$4(Run.scala:92)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at sbt.util.InterfaceUtil$$anon$1.get(InterfaceUtil.scala:10)
at sbt.TrapExit$App.run(TrapExit.scala:257)
at java.lang.Thread.run(Thread.java:748)
Expectation
We should probably only allow @static methods to be defined in a static object.
The text was updated successfully, but these errors were encountered:
Minimized code
Output
Expectation
We should probably only allow @static methods to be defined in a static object.
The text was updated successfully, but these errors were encountered: