On Wed, 4 Oct 2023 10:08:31 GMT, Aggelos Biboudis <[email protected]>
wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java line 3001:
>>
>>> 2999: }
>>> 3000:
>>> 3001: static class TypePairs {
>>
>> I believe this could be a record between two TypeSymbols? Then you could
>> have an additional constructor that takes two types and retrieves their
>> `tsym` and call the canonical constructor (and then you can drop
>> equals/hashcode).
>
> Done and simplified
> https://github.com/openjdk/jdk/pull/15638/commits/ef98c040c909981077936c6ff4280b6da04b8c24.
> Do you think we can simplify further (or benefit at all) by also eliminating
> duplication between SwitchBootstrap and Lower?
I don't think there's an easy easy way to deduplicate the code, as the code
occurs in two different modules, so it's messy (as bootstrap javac compilation
cannot depend on stuff that is in the latest latest JDK, as it has to compile
against JDK N-1, and, on the other hand, java.base cannot depend on any other
modules). So, leave it as is, maybe add a comment that the code should stay in
sync :-)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15638#discussion_r1348607516