Skip to content

linking error to java's Consumer.accept when using Scala.js #16065

Closed
@jv3x

Description

@jv3x

In scala3/js (scala 3.2.0, scalajs 1.11.0), but not in scala2/js, there is linking error "Referring to non-existent method ....accept(java.lang.Object)void" in the following:

  def foo(): Unit = {
    val set = new util.LinkedHashSet[String]
    set.forEach(bar)
  }

  def bar(v: String): Unit = ()

I can workaround it like this in foo:

  val barc: util.function.Consumer[String] = bar
  set.forEach(barc)

There is "(modName / Compile / fastLinkJS) There were linking errors". Couldn't reproduce on the JVM.

Sorry if reporting to wrong repo, scalajs says if it is only on 3.x, we should report here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions