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

Jan Lahoda jlahoda at openjdk.java.net
Thu Sep 9 18:19:04 UTC 2021


On Mon, 23 Aug 2021 23:29:15 GMT, Vicente Romero <vromero 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.

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

Marked as reviewed by jlahoda (Reviewer).

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


More information about the compiler-dev mailing list