Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8297158

Suspicious collection method call in Types.isSameTypeVisitor

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 11, 17, 20
    • tools
    • b08

      See https://github.com/openjdk/jdk/blob/master/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L1410-L1413:

                              if (tMap.containsKey(ti)) {
                                  throw new AssertionError("Malformed intersection");
                              }
                              tMap.put(ti.tsym, ti);

      Map<Symbol,Type> may not contain keys of type 'Type'

      Obvious fix (changing to containsKey(ti.tsym) ) causes the AssertionError to be thrown in the following tests:
      tools/javac/lambda/intersection/IntersectionTargetTypeTest.java
      tools/javac/cast/intersection/IntersectionTypeCastTest.java

      Snippet from the IntersectionTargetTypeTest log:

      java.lang.AssertionError: Error thrown when compiling the following code:
      ..
      interface C { void m(); }
      ..
      class Test {
         void m() { }
         void test() {
            Object o = (C & C)()->{};
         } }

      The code in question was introduced in JDK-8143852

            vromero Vicente Arturo Romero Zaldivar
            djelinski Daniel Jelinski
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: