RFR: 8268885: duplicate checkcast when destination type is not first type of intersection type

Vicente Romero vromero at openjdk.java.net
Thu Sep 9 18:40:10 UTC 2021


On Thu, 9 Sep 2021 18:16:12 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

>> Please review this PR which is fixing the following bug: javac is generating duplicate checkcast for cases like:
>> 
>> 
>> class IntersectionTypeTest {
>>     interface I1 {}
>>     interface I2 {}
>>     static class C {}
>>     void test() {
>>         I2 i = (I1 & I2) new C();
>>     }
>> }
>> 
>> basically when an intersection type is used in a cast expression and the target is not the type in the intersection.
>> 
>> TIA
>> 
>> PS. I also ran the JCK tests for this patch, same results as without the patch
>
> Looks good to me.

@lahodaj thanks for the review

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

PR: https://git.openjdk.java.net/jdk/pull/5235


More information about the compiler-dev mailing list