@@ -76,11 +76,16 @@ object TransformOverride {
76
76
java.lang.Double .TYPE -> classOf [java.lang.Double ]
77
77
)
78
78
79
- private def typeValidation [A , B ](failMsg : String , aIn : Class [A ], bIn : Class [B ]): Unit = {
79
+ private def typeValidation [A , B ](
80
+ expectedIn : Class [B ],
81
+ actualIn : Class [A ],
82
+ failMsg : String
83
+ ): Unit = {
80
84
// get normal java types instead of primitives
81
- val (a, b) = (primitiveMapping.getOrElse(aIn, aIn), primitiveMapping.getOrElse(bIn, bIn))
82
- if (! a.isAssignableFrom(b))
83
- throw new IllegalArgumentException (s " $failMsg Expected: ${aIn} Found: ${bIn}" )
85
+ val expected = primitiveMapping.getOrElse(expectedIn, expectedIn)
86
+ val actual = primitiveMapping.getOrElse(actualIn, actualIn)
87
+ if (! expected.isAssignableFrom(actual))
88
+ throw new IllegalArgumentException (s " $failMsg Expected: $expected Found: $actual" )
84
89
}
85
90
86
91
/**
@@ -105,9 +110,9 @@ object TransformOverride {
105
110
def of [T : ClassTag , U ](name : String , fn : T => U ): PTransformOverride = {
106
111
val wrappedFn : T => U = fn.compose { t : T =>
107
112
typeValidation(
108
- s " Input for override transform $name does not match pipeline transform. " ,
113
+ implicitly[ ClassTag [ T ]].runtimeClass ,
109
114
t.getClass,
110
- implicitly[ ClassTag [ T ]].runtimeClass
115
+ s " Input for override transform $name does not match pipeline transform. "
111
116
)
112
117
t
113
118
}
@@ -132,9 +137,9 @@ object TransformOverride {
132
137
val wrappedFn : T => JIterable [U ] = fn
133
138
.compose { t : T =>
134
139
typeValidation(
135
- s " Input for override transform $name does not match pipeline transform. " ,
140
+ implicitly[ ClassTag [ T ]].runtimeClass ,
136
141
t.getClass,
137
- implicitly[ ClassTag [ T ]].runtimeClass
142
+ s " Input for override transform $name does not match pipeline transform. "
138
143
)
139
144
t
140
145
}
0 commit comments