-
Notifications
You must be signed in to change notification settings - Fork 375
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
Avoid StackOverflowError in TypeUtils#resolveGenerics #9858
Avoid StackOverflowError in TypeUtils#resolveGenerics #9858
Conversation
Fall back to the result of `ensureBaseType` when the generic variable is declared in the same class as it is used.
Thanks! Are you aware of any other issues preventing Java 21 from building and passing tests, or can we also add Java 21 to the nightly CI runs? |
Until now I did not build GWT on JDK21. But in a first build I just did, it fails due to |
Okay, updating errorprone might not be possible. At least not easy? It requires JDK11 starting with v2.11.0. And in v2.22.0 they mention that they consider to require JDK 17 in a future release. Either CI runs need to drop running on Java 8, or there has to be a way to use diffrent versions of errorprone per JDK version. But I think this discussion deservers its own issue at this point. :) |
Thanks for the investigation. I'll see about manually running more tests on Java 21 to validate this fix, and after this release we'll be dropping support for building GWT or running the compiler on Java 8. We may keep Java 8 support for the server, it will depend on what kind of pushback we get on other changes. |
Running AutoBeanSuite on Java 21 reproduces this issue:
While we can't build GWT with 21 yet, you can first do an
I confirmed that this patch fixed those tests, then ran |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of test.web.htmlunit
passed in Java 21, marking as approved, will merge in a day or so as usual to give time for any more discussion.
While the issue (#9855) is related to JDK21 and its new
getFirst
andgetLast
methods in theList
/SequencedCollection
interfaces, the current behaviour can in theory cause problems on JDK versions before 21 too.With this fix the
TypeUtils#resolveGenerics
method falls back toTypeUtils#ensureBaseType
(already used method-level type variables) when a type variable is used in the same class where it has been defined.This class for example, currently causes a
StackOverflowError
. With this PR the error is avoided, and theT
is resolved asjava.lang.Object
Fixes #9855