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

Expression with transform() in Paths does not compile

XMLWordPrintable

    • generic
    • generic

      ADDITIONAL SYSTEM INFORMATION :
      same with with Java 21

      A DESCRIPTION OF THE PROBLEM :
      Following simple expression does not compile:

          Paths.get("".transform(s -> s));

      Compiler should 'see' that the expression is of type String and compile to Path.get(String,String...).


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      try to compile
        Paths.get("".transform(s -> s));


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      compile without error
      ACTUAL -
      does not compile

      ---------- BEGIN SOURCE ----------
        public static void main(final String[] args) {
          Paths.get("".transform(s -> s));
        }

      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: