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

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Nov 3 16:06:59 UTC 2025


On Mon, 3 Nov 2025 15:58:51 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   addressing review comments
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java line 3901:
> 
>> 3899:             boolean sameTypeArguments(List<Type> ts, List<Type> ss) {
>> 3900:                 while (ts.nonEmpty() && ss.nonEmpty()
>> 3901:                         && exactTypeVisitor.visit(ts.head, ss.head)) {
> 
> You could delegate to `sameTypeComparator` here?

Another possibility would be to declare an overloaded method to `isSameType` that takes a type argument comparator function. And maybe the default type argument comparator function is `containsTypeEquivalent` but then other clients could override that.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28101#discussion_r2487016381


More information about the compiler-dev mailing list