Use correct index when try to find the type of the message

This commit is contained in:
Norman Maurer 2013-02-08 10:40:46 +01:00
parent ff5aec0c78
commit 2f12f95d9b

View File

@ -50,12 +50,12 @@ public abstract class TypeParameterMatcher {
for (;;) {
if (currentClass.getSuperclass() == parameterizedSuperClass) {
Type[] types = ((ParameterizedType) currentClass.getGenericSuperclass()).getActualTypeArguments();
if (types.length - 1 < typeParamIndex || !(types[0] instanceof Class)) {
if (types.length - 1 < typeParamIndex || !(types[typeParamIndex] instanceof Class)) {
throw new IllegalStateException(
"cannot determine the type of the type parameter of " + thisClass.getSimpleName());
}
Class<?> messageType = (Class<?>) types[0];
Class<?> messageType = (Class<?>) types[typeParamIndex];
if (messageType == Object.class) {
matcher = NOOP;
} else {