Bad symbolic reference with discord4j

201 Views Asked by At

I'm trying to use discord4j 3.2 and slash command in scala 3 code. When I added the code for slash command, sbt gave me this error when compiling:

[error] Bad symbolic reference. A signature
[error] refers to Value/T in package org.immutables.value which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling the signature.
[warn] Caught: java.lang.AssertionError: assertion failed: failure to resolve inner class:
[warn] externalName = org.immutables.value.Value$Immutable,
[warn] outerName = org.immutables.value.Value,
[warn] innerName = Immutable
[warn] owner.fullName = org.immutables.value.Value
[warn] while parsing ~/.cache/coursier/v1/https/oss.sonatype.org/content/repositories/snapshots/com/discord4j/discord-json/1.6.10-SNAPSHOT/discord-json-1.6.10-20210908.025209-4.jar(discord4j/discordjson/json/InteractionApplicationCommandCallbackData.class) while parsing annotations in ~/.cache/coursier/v1/https/oss.sonatype.org/content/repositories/snapshots/com/discord4j/discord-json/1.6.10-SNAPSHOT/discord-json-1.6.10-20210908.025209-4.jar(discord4j/discordjson/json/InteractionApplicationCommandCallbackData.class)
[error] Bad symbolic reference. A signature

I have no issues compiling code creating slash command using the same version of discord4j but in scala 2 code.

Here's my sbt file:

val scala3Version = "3.0.2"

val scala2deps = Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.6.0",
  "com.typesafe.akka" %% "akka-actor-typed" % "2.6.0",
  "com.typesafe.akka" %% "akka-stream" % "2.6.8",
  "com.typesafe.akka" %% "akka-http" % "10.2.0",

  "org.scalaz" %% "scalaz-core" % "7.2.29",

  "io.projectreactor" %% "reactor-scala-extensions" % "0.8.+",

  "org.json4s" %% "json4s-jackson" % "3.+",

  "com.lihaoyi" %% "requests" % "0.2.0",
).map(d ⇒ d.cross(CrossVersion.for3Use2_13))

lazy val root = project
  .in(file("."))
  .settings(
    name := "PUGBot",
    version := "0.1.0",

    scalacOptions ++= Seq(
      "-language:postfixOps",
      "-language:implicitConversions",
      ),


    scalaVersion := scala3Version,

    resolvers += "d4j-snapshot" at "https://oss.sonatype.org/content/repositories/snapshots",

    libraryDependencies ++= Seq(
      "com.discord4j" % "discord4j-core" % "3.2.0-RC3",
    ) ++ scala2deps,

  )

How can I fix this error?

1

There are 1 best solutions below

0
MichealZ On

I have similar issue with de.flapdoodle.embed.mongo 3.0.0 and Scala 3.0.2:

scalac: Bad symbolic reference. A signature
refers to Value/T in package org.immutables.value which is not available.
It may be completely missing from the current classpath, or the version on
the classpath might be incompatible with the version used when compiling the signature.
scalac: Caught: java.lang.AssertionError: assertion failed: failure to resolve inner class:
externalName = org.immutables.value.Value$Immutable,
outerName = org.immutables.value.Value,
innerName = Immutable
owner.fullName = org.immutables.value.Value
while parsing /Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/de/flapdoodle/embed/de.flapdoodle.embed.mongo/3.0.0/de.flapdoodle.embed.mongo-3.0.0.jar(de/flapdoodle/embed/mongo/config/MongodConfig.class) while parsing annotations in /Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/de/flapdoodle/embed/de.flapdoodle.embed.mongo/3.0.0/de.flapdoodle.embed.mongo-3.0.0.jar(de/flapdoodle/embed/mongo/config/MongodConfig.class)

I have added org.immutables.value library as Sbt dependency and it helped:

"org.immutables" % "value" % "2.8.8"