Open joekarl opened 7 years ago
Unsurprisingly the same behavior is noted with scala Longs and Booleans.
Option[java.lang.Long]
is working but not Option[scala.Long]
because
java.lang.Long
implements java.lang.reflect.Type
whereas scala.Long
doesn't
com.datasift.dropwizard.scala.jersey.inject.ScalaParamConvertersProvider
overrides method
override def getConverter[T](rawType: Class[T], genericType: Type, annotations: Array[Annotation]): ParamConverter[T] = {
So essentially none of the native classes in "scala
" package would work.
Essentially, we need reflection compatibility between scala types and java types, to get the above to work, I guess - there's an open ticket - https://issues.scala-lang.org/browse/SI-7317
Been scratching my head at this one for a bit now after doing an upgrade from the old massrelevance version to the datasift maintained version.
Specifically the error I'm running into is whenever I try to add something like
QueryParam("foo") foo: Option[Int]
to a resource.I've done some digging, and similar combinations of
QueryParam("foo") foo: Option[java.lang.Integer]
andQueryParam("foo") foo: Int
work as expected.This can be replicated by adding the following test/resource to
ScalaApplicationSpecIT.scala
(and actually just adding that resource path with the parameterOption[Int]
will fail validation of the resource on test suite startup.I think this has something to do with some weirdness with either type resolution or erasure as by introspecting
ScalaParamConvertersProvider
during test time the call togetConverter
as the parameter type is being listed attype=class scala.Option
and the generic type at runtime isscala.Option[java.lang.Object]
Actual error the container spits out