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

JShell: TypeProjection .stream().map(...).collect(...) must be replaced with .map(...)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • b153
    • Not verified

      The fix for JDK-8171981 brought in JEP-286 code. A problem with the use of == was noted and traced to the use of .stream().map(...).collect(...) on a List. These lists are javac lists not java.util lists and == is a common usage but requires that .map be used instead. This was fixed in the commit for JDK-8171981.

      However, there was a second use of .stream().map(...).collect(...) with == which was not corrected.

                      Type outer = t.getEnclosingType();
                      Type outer1 = visit(outer, upward);
                      List<Type> typarams = t.getTypeArguments();
                      List<Type> typarams1 = typarams.stream()
                              .map(ta -> mapTypeArgument(ta, upward))
                              .collect(List.collector());
                      if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
                          //not defined
                          return syms.botType;
                      }
                      if (outer1 == outer && typarams1 == typarams) return t;

      This bug is to fix that usage.

            rfield Robert Field (Inactive)
            rfield Robert Field (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: