override def fromAvro()

in elitzur-avro/src/main/scala/com/spotify/elitzur/converters/avro/AvroConverter.scala [44:57]


  override def fromAvro(v: Any, schema: Schema, doc: Option[String] = None): T = {
    // null.asInstanceOf[Long] == 0L in scala
    // because scala.Long == primitive java.lang.long (lowercase-l)
    // see the spec change to represent this behavior at
    // https://github.com/scala/scala-dist/commit/804c390adf62fd4380b29861cdcc3c35d6194093
    // found via https://github.com/scala/bug/issues/1245
    if (v == null) {
      throw new NullPointerException("Expected non-optional field to be non-null in Avro. " +
        "To fix, declare your Elitzur case class with any nullable Avro union fields " +
        "wrapped in options instead of declaring as the type directly.")
    } else {
      v.asInstanceOf[T]
    }
  }