Skip to content

Internal error on Scala 2.13 given generic JsonValueCodec to be used transitively #1245

Open
@tribbloid

Description

@tribbloid

Code example:

trait Imp0 {

  case class User(
      name: String,
      age: Int,
      path: Path = Path.of("http://google.com")
  )

  implicit def pojoCodec[T <: AnyRef]: JsonValueCodec[T] = {

    print_@("pojo")
    ???
  } // fallback to jackson here

  implicit lazy val pojoCodec2: JsonValueCodec[AnyRef] = { // only works iif JsonValueCodec is contravariant

    print_@("pojo")
    ???
  } // fallback to jackson here
}

object JsoniterFallbackExample extends Imp0 {

  // Generate codec for Person (automatically handles Address too)
  implicit lazy val personCodec: JsonValueCodec[User] = JsonCodecMaker.make
}

The intention is to use Jackson to handle Java Path which is not a Scala product type. When compiling, it generates the following error:

[Error] /home/peng/git/scalaspike/common/generic/src/test/scala/com/tribbloids/spike/generic/jsoniter/JsoniterFallbackExample.scala:34:72: Internal error: unable to find the outer accessor symbol of <$anon: com.github.plokhotnyuk.jsoniter_scala.core.JsonValueCodec>
one error found

What is "outer accessor symbol" here? Can the internal error stack trace be reported and potentially be used in telemetry?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions