-
Notifications
You must be signed in to change notification settings - Fork 15
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
StackOverflowError in VarMap.map when calling GenericTypeReflector.getParameterTypes() #27
Comments
This problem can be simplified to a single self-referential type. import java.lang.reflect.Method;
import java.util.Objects;
public class StackOverflowReproducer {
static abstract class Resource<StatusT> {
}
static class ProjectValidator {
public <T extends Resource<T>>
void validate(long id, Class<T> klass) {
throw new UnsupportedOperationException("Just for testing");
}
}
public static void main(String[] args) throws NoSuchMethodException {
Class<?> cls = ProjectValidator.class;
Method method = Objects.requireNonNull(cls.getMethod("validate", long.class, Class.class));
io.leangen.geantyref.GenericTypeReflector.getParameterTypes(method, cls);
}
} |
This can probably be avoided by tracking already seen |
The VarMap now tracks the currently resolving TypeVars to detect, if we already resolve the same TypeVar. Fixes leangen#27
@leonard84 The I have created the PR #30, which fixes the issue but returning the incomplete type. |
The VarMap now tracks the currently resolving TypeVars to detect, if we already resolve the same TypeVar. Fixes leangen#27
Phew, this thing really sent me soul-searching 😅 Nothing seemed correct. Terminating with |
@kaqqao I have tested the Spock issue report against the geantyref master, and it fixes the issue. Thanks a lot! |
Thanks, @kaqqao, for the fix. I'm looking forward to the release. |
Released v1.3.16 just now 🚀 |
mfriedenhagen reported an issue in Spock spockframework/spock#1909 where geantyref throws a
StackOverflowError
.I have removed the Spock dependency from the reproducer attached to the Spock issue, and the error is still there:
The exception stack looks like:
The used geantyref version is
io.leangen.geantyref:geantyref:1.3.15
Tested for Java
8
and17
The text was updated successfully, but these errors were encountered: