From 8df198de277d506fcde255cefbfd838756c924ef Mon Sep 17 00:00:00 2001 From: szareiangm Date: Fri, 3 Jul 2020 17:08:50 -0400 Subject: [PATCH] Common: replace use of erasure with runtimeClass (Closes #252) --- .../common/utils/MapTransformer.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala index 93c0bf566..4157502de 100644 --- a/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala +++ b/modules/common/src/main/scala/com.snowplowanalytics.snowplow.enrich/common/utils/MapTransformer.scala @@ -91,7 +91,7 @@ object MapTransformer { )( implicit m: Manifest[T] ): ValidatedNel[FailureDetails.EnrichmentFailure, T] = { - val newInst = m.runtimeClass.newInstance() + val newInst = m.runtimeClass.getDeclaredConstructor().newInstance() val result = _transform(newInst, sourceMap, transformMap, getSetters(m.runtimeClass)) // On success, replace the field count with the new instance result.map(_ => newInst.asInstanceOf[T])