RFR: 8320220: Compilation of cyclic hierarchy causes infinite recursion

Vicente Romero vromero at openjdk.org
Mon Feb 24 17:17:53 UTC 2025


On Mon, 24 Feb 2025 16:54:18 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 2381:
>> 
>>> 2379:                   .filter(s -> !s.type.isErroneous())
>>> 2380:                   .filter(ClassSymbol.class::isInstance)
>>> 2381:                   .map(ClassSymbol.class::cast)
>> 
>> this method will invoke Class::isInstance again, probably better to just do `(c -> (ClassSymbol)c)`?
>
>> this method will invoke Class::isInstance again, probably better to just do `(c -> (ClassSymbol)c)`?
> 
> I was under the impression that with Hotspot, there was no performance difference between `ClassSymbol.class::cast` and `c -> (ClassSymbol)c`. Is that not correct?

yep we should be fine here, probably just a matter of personal preference I guess

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23704#discussion_r1968081303


More information about the compiler-dev mailing list