-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic Type Is Not Supported in Input Type #468
Comments
Same issue here. Maybe i'm wrong, but the only thing required seems to modify the if (this is ParameterizedType) {
this.rawType as Class<*>
} else if (this is TypeVariable<*>)
this.bounds[0] as Class<*>
else {
this as Class<*>
} Is there a reason this issue has been open for almost a year ? |
Hey, it's been another half-year. Any reason why this hasn't been fixed, if the solution is indeed that simple? |
That's the wrong spot, because at that point in I believe the issue is solved here. I'll put in a PR if/when I can figure out how to write a test for this. (This is my first foray into Kotlin)
|
Describe the bug
Trying to add a definition factory that can dynamically generate input types containing generic types as fields. But it turns out to be a crash.
To Reproduce
Have a schema like this:
And a corresponding Java resolver and return type like this:
I have a factory below to create a dynamic input type. Below is the core part:
Once you try to build the whole schema, it crashes.
Expected behavior
Should parse schema successfully.
Exception Stacks
Possible reason:
I've checked the current implementation and found that in
SchemaClassScanner.kt:339
, you have this code:This
javaType.unwrap()
will discard generic type information and then when trying to match type field and its Java type, you will get a "T" as field's type, which results in the final crash. Here we need to get the real type (LanguageInput
in my case) behind the generic label.Actually this happens every time when you try to put a Java type with generic fields as a variable's type.
Hope this issue can be fixed soon. Otherwise I have to manually define types myself both in schema and Java implementation.
Thank you.
The text was updated successfully, but these errors were encountered: