RFR: 8337142: StackOverflowError in Types.containsTypeRecursive with deeply nested type hierarchy
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Nov 3 11:50:01 UTC 2025
On Mon, 3 Nov 2025 11:44:08 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> > > Question: what if containsTypeEquivalent is defined in terms of containsTypeRecursive? Won't the cache then prevent the SOE?
> >
> >
> > This seems to fix the SOE -- but it introduces some spurious errors in the build... maybe worth more investigation? E.g. it almost seems as if javac kind of relies on cycles not to be detected...
>
> Nah... it seems to me that `containsTypeRecursive` never sees the same type pair twice in a nested context. We keep adding newer type to the type cache, but it seems like the program is running away here...
Your analysis in this PR seems to imply that the cycle occurs via TypePair::equals, but when debugging I don't see this method being invoked at all (I do see the hashCode method being invoked though). I think we need to characterize the nature of the recursion more precisely.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28101#issuecomment-3480123502
More information about the compiler-dev
mailing list