Skip to content

Incremental compiler misses change to value class, and results to NoSuchMethodError at runtime #1171

@xuwei-k

Description

@xuwei-k

see https://github.com/xuwei-k/sbt-value-class-bug

step

From sbt shell, compile A.scala (without value class)

case class A(a: String)

B.scala:

object B {
  def foo = A("a")
}

Change to A.scala to following:

case class A(a: String) extends AnyVal

From sbt shell, run (without clean )

problem

[info] [error] (run-main-0) java.lang.NoSuchMethodError: B$.foo()LA;
[info] java.lang.NoSuchMethodError: B$.foo()LA;
[info]  at C$delayedInit$body.apply(C.scala:3)
[info]  at scala.Function0$class.apply$mcV$sp(Function0.scala:40)
[info]  at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
[info]  at scala.App$$anonfun$main$1.apply(App.scala:71)
[info]  at scala.App$$anonfun$main$1.apply(App.scala:71)
[info]  at scala.collection.immutable.List.foreach(List.scala:318)
[info]  at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
[info]  at scala.App$class.main(App.scala:71)
[info]  at C$.main(C.scala:1)
[info]  at C.main(C.scala)
[info]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[info]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
[info]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[info]  at java.lang.reflect.Method.invoke(Method.java:606)
[info] [trace] Stack trace suppressed: run last compile:run for the full output.
[info] java.lang.RuntimeException: Nonzero exit code: 1
[info]  at scala.sys.package$.error(package.scala:27)
[info] [trace] Stack trace suppressed: run last compile:run for the full output.
[info] [error] (compile:run) Nonzero exit code: 1
[info] [error] Total time: 4 s, completed Mar 11, 2014 9:32:49 AM
[error] x value-class-bug / simple

notes

NoSuchMethodError does not occur if clean is executed first.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions