RFR: 8337142: StackOverflowError in Types.containsTypeRecursive with deeply nested type hierarchy

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Nov 3 11:47:02 UTC 2025


On Mon, 3 Nov 2025 11:17:32 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...

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28101#issuecomment-3480108251


More information about the compiler-dev mailing list