Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError when creating implicit validator #123

Open
buildreactive opened this issue Jun 6, 2018 · 5 comments
Open

NoSuchMethodError when creating implicit validator #123

buildreactive opened this issue Jun 6, 2018 · 5 comments

Comments

@buildreactive
Copy link

I'm getting the following error:

java.lang.NoSuchMethodError: scala.collection.immutable.$colon$colon.tl$1()Lscala/collection/immutable/List;
	at com.wix.accord.transform.FunctionDescriber$class.describeFunction(ExpressionDescriber.scala:145)
	at com.wix.accord.transform.ValidationTransform.describeFunction(ValidationTransform.scala:24)
	at com.wix.accord.transform.ValidationTransform.<init>(ValidationTransform.scala:36)
	at com.wix.accord.transform.ValidationTransform$.apply(ValidationTransform.scala:240)

When attempting to create the following validator:

object foo {
	implicit val shipValidator = validator[Ship] { p =>
		p.summary.code.length is between(1, 4) // The expression being validated is resolved automatically, see below
		p.summary.code should matchRegex(".*")
		p.summary.paxCapacity as "ship code" should be > 5 // You can also explicitly describe the expression being validated
	}
}

For the following class:

case class Ship(
	summary: ShipSummary,
	detail: ShipDetail,
	decks: Decks,
	fireZones: FireZones,
	shipsTime: Option[Instant]
) {
	def safeId = summary.id.getOrElse(UUID.randomUUID())
}

object Ship {
	type LegacyID = Map[String, String]
	type Attributes = Map[String, String]
	//... some other stuff
	implicit val optionString: Format[Ship] = Json.format
}
@holograph
Copy link
Contributor

Thanks for reporting, I'll look into it shortly (things are a little sluggish these days because of the transfer of ownership, but will sort themselves out soon)

@holograph
Copy link
Contributor

I can't seem to reproduce this; can you specify which versions of Accord, Scala and JDK you're using?

@holograph
Copy link
Contributor

Perhaps you are compiling with Scala 2.12.5 with JDK 9/10? It has a known regression with macros: https://github.com/scala/scala/releases/tag/v2.12.5

@buildreactive
Copy link
Author

Nope. 12.2.6 and JDK 8.

@holograph
Copy link
Contributor

@zbeckman Hold on, is this at compile or runtime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants