Description
I've been using classmate
for type resolutions within my victools/jsonschema-generator library.
Unfortunately, I've hit a snag. It's this particular piece of code in the TypeResolver (lines 288-299)
:
for (int i = 0; i < paramCount; ++i) {
ResolvedType t = placeholders[i].actualType();
// Is it ok for it to be left unassigned? For now let's not allow that
// 18-Oct-2017, tatu: Highly likely that we'll need to allow this, substitute with "unknown" --
// had to do that in Jackson. Occurs when subtype is generic, with "bogus" type declared
// but not bound in supertype(s). But leaving checking in for now.
if (t == null) {
throw new IllegalArgumentException("Failed to find type parameter #"+(i+1)+"/"
+paramCount+" for "+subtype.getName());
}
typeParams[i] = t;
}
Short term: I'm wondering what exactly I can do on my side short of copy-pasting the whole resolveSubtype()
method and leaving out this unfortunate exception being thrown?
Can I somehow provide extra type bindings (even if they are just Object.class
) to make it work?
Mid term: could there be some kind of configuration option on the type resolver to simply set it to (the resolved version of) Object.class
or some lower bounds of the generic (if that's not already happening) instead of throwing an exception?
How did you handle this in Jackson (as per the above in-line comment)?