Skip to content

Commit

Permalink
Minor error message improvement wrt #2821
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Sep 5, 2020
1 parent 3ed0767 commit d268a05
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,8 @@ private JavaType _mapType(Class<?> rawClass, TypeBindings bindings,
} else {
List<JavaType> typeParams = bindings.getTypeParameters();
// ok to have no types ("raw")
switch (typeParams.size()) {
final int pc = typeParams.size();
switch (pc) {
case 0: // acceptable?
kt = vt = _unknownType();
break;
Expand All @@ -1175,7 +1176,9 @@ private JavaType _mapType(Class<?> rawClass, TypeBindings bindings,
vt = typeParams.get(1);
break;
default:
throw new IllegalArgumentException("Strange Map type "+rawClass.getName()+": cannot determine type parameters");
throw new IllegalArgumentException(String.format(
"Strange Map type %s with %d type parameter%s (%s), can not resolve",
ClassUtil.nameOf(rawClass), pc, (pc == 1) ? "" : "s", bindings));
}
}
return MapType.construct(rawClass, bindings, superClass, superInterfaces, kt, vt);
Expand Down

0 comments on commit d268a05

Please sign in to comment.