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

Vicente Romero vromero at openjdk.java.net
Mon Aug 23 23:35:49 UTC 2021


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

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

Commit messages:
 - 8268885: duplicate checkcast when destination type is not first type of intersection type

Changes: https://git.openjdk.java.net/jdk/pull/5235/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=5235&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8268885
  Stats: 37 lines in 2 files changed: 24 ins; 3 del; 10 mod
  Patch: https://git.openjdk.java.net/jdk/pull/5235.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/5235/head:pull/5235

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


More information about the compiler-dev mailing list