Skip to content

Commit 4106ac2

Browse files
committed
fixed a bug: ClassCastException occurs during generating a class that has fields of TypeVariable types (MSGPACK-75)
1 parent 34d4167 commit 4106ac2

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/main/java/org/msgpack/template/TemplateRegistry.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.lang.reflect.GenericArrayType;
2828
import java.lang.reflect.ParameterizedType;
2929
import java.lang.reflect.Type;
30+
import java.lang.reflect.TypeVariable;
3031
import java.lang.reflect.WildcardType;
3132
import java.math.BigDecimal;
3233
import java.math.BigInteger;
@@ -218,7 +219,8 @@ public synchronized Template lookup(Type targetType) {
218219
return tmpl;
219220
}
220221

221-
if (targetType instanceof WildcardType) {
222+
if (targetType instanceof WildcardType ||
223+
targetType instanceof TypeVariable) {
222224
// WildcardType is not a Class<?>
223225
tmpl = new AnyTemplate<Object>(this);
224226
register(targetType, tmpl);

0 commit comments

Comments
 (0)