scalaz-deriving
scalaz-deriving copied to clipboard
NoSuchMethodError
I just ran into something I could not figure out.
Using 0.14.0 of deriving published under com.fommil
, the following code works fine.
With 1.0 under org.scalaz
it throws an error.
Note that the error happens on any derived typeclass, this one uses scalaz.Equal
as an example:
Error:
[info] java.lang.NoSuchMethodError: scalaz.$div$tilde$bslash$.unapply(Lscalaz/$div$tilde$bslash;)Lscala/O
[info] ption;
[info] scalaz.Derivez$$anon$1.$anonfun$productz$2(Derivez.scala:88)
[info] scalaz.Derivez$$anon$1.$anonfun$productz$2$adapted(Derivez.scala:87)
[info] scala.collection.LinearSeqOptimized.forall(LinearSeqOptimized.scala:81)
[info] scala.collection.LinearSeqOptimized.forall$(LinearSeqOptimized.scala:78)
[info] scala.collection.immutable.List.forall(List.scala:86)
[info] scalaz.std.ListInstances$$anon$1.all(List.scala:114)
[info] scalaz.std.ListInstances$$anon$1.all(List.scala:14)
[info] scalaz.Derivez$$anon$1.scalaz$Derivez$$nestedInanon$$$anonfun$productz$1(Derivez.scala:87)
[info] scalaz.Derivez$$anon$1$$anonfun$productz$9.equal(Derivez.scala:85)
[info] blabla.foo.SchemaSpec$.eventEquals(SchemaSpec.scala:102)
[info] blabla.foo.SchemaSpec$.$anonfun$tests$2(SchemaSpec.scala:94)
Flip open code
package blabla
import eu.timepit.refined._
import eu.timepit.refined.api.{ Refined, RefinedTypeOps }
import eu.timepit.refined.boolean._
import eu.timepit.refined.char._
import eu.timepit.refined.collection._
import eu.timepit.refined.string._
import eu.timepit.refined.types.string.{ HexString, NonEmptyString }
import io.circe._
import io.circe.refined._
import scalaz.{ Equal, Scalaz, Show }
import Scalaz._
import blabla.common.refined.scalaz._
package object foo {
type ShortString = String Refined (NonEmpty And MaxSize[W.255
.T])
object ShortString extends RefinedTypeOps[ShortString, String]
type ShortUpperCaseString = String Refined (NonEmpty And MaxSize[W.255
.T] And Forall[UpperCase])
object ShortUpperCaseString extends RefinedTypeOps[ShortUpperCaseString, String]
type IPAddress = String Refined (IPv4 Or IPv6)
object IPAddress extends RefinedTypeOps[IPAddress, String]
type ISO8601 = String Refined MatchesRegex[
W."^(-?(?:[1-9][0-9]*)?[0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])(\\\\.[0-9]+)?(Z)?$"
.T
]
object ISO8601 extends RefinedTypeOps[ISO8601, String]
type Source = ShortString
type Client = ShortUpperCaseString
type Hostname = NonEmptyString
type Username = NonEmptyString
type ProcessName = NonEmptyString
type Date = ISO8601
type Command = NonEmptyString
type Path = NonEmptyString
type ServerName = NonEmptyString
type Group = ShortString
type ProcessId = String Refined Uuid
type SegmentId = HexString
type ModelConfigUrl = String Refined Url
type BsDecoded = NonEmptyString
type BsScore = Double Refined (NonNegative And LessEqual[W.1.0
.T])
type BsVersion = ShortString
object BsDecoded extends RefinedTypeOps[BsDecoded, String]
object BsScore extends RefinedTypeOps[BsScore, Double]
}
@scalaz.deriving(Decoder, Equal, ObjectEncoder, Show)
final case class SomethingSomething(
source: Source,
client: Client,
hostname: Hostname,
username: Username,
process_name: ProcessName,
parent_name: ProcessName,
interface_ip: IPAddress,
start: Date,
terminated: Boolean,
last_update: Date,
last_server_update: Date,
cmdline: Command,
path: Path,
cb_server: ServerName,
group: Group,
process_id: ProcessId,
segment_id: SegmentId,
bsDecoded: BsDecoded,
bsScore: BsScore,
bsVersion: BsVersion
)