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

Path.of throws NoSuchMethod exception

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Windows 10
      Windows 1117.0.2

      A DESCRIPTION OF THE PROBLEM :
      Given following method signatures:

      FileSystems.getDefault().getPath("","");
      Paths.get("","");
      Path.of("","");

      First two work. While Path.of doesn't. I get a NoSuchMethod exception. I know another person who has the same issue. He works on Windows 11. Same JDK version.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Use following three methods:

      FileSystems.getDefault().getPath("","");
      Paths.get("","");
      Path.of("","");

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Last method also works
      ACTUAL -
      Last method doesn't work

      ---------- BEGIN SOURCE ----------
      import java.nio.file.*;

      public class Test {

          public static void main(String[] args) {
              FileSystems.getDefault().getPath("C:/Users","");
              Paths.get("C:/Users","");
              Path.of("C:/Users","");
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Use FileSystems.getDefault().getPath("",""); or Paths.get("","");

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            tongwan Andrew Wang
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: