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

FileManager.getLocation(StandardLocation.MODULE_SOURCE_PATH) is unsupported

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 9
    • tools

      To reproduce
      @Test
          void testModuleSourcePath(Path base) throws Exception {
              JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
              StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
              Path modules = base.resolve("modules");
              Path classes = Files.createDirectories(base.resolve("classes"));
              tb.writeJavaFiles(modules.resolve("m"), "module m { }", "package p; public class D { }");
              compiler.getTask(null, fm, null,
                      Arrays.asList("-modulesourcepath", modules.toString(), "-d", classes.toString()),
                      null,
                      fm.getJavaFileObjects(modules.resolve("m/p/D.java")))
                      .call();

              fm.getLocation(StandardLocation.MODULE_SOURCE_PATH).forEach(System.out::println);
          }

      java.lang.UnsupportedOperationException
      at com.sun.tools.javac.file.Locations$ModuleSourcePathLocationHandler.getPaths(jdk.compiler@9-internal/Locations.java:1304)
      at com.sun.tools.javac.file.Locations.getLocation(jdk.compiler@9-internal/Locations.java:1527)
      at com.sun.tools.javac.file.JavacFileManager.getLocation(jdk.compiler@9-internal/JavacFileManager.java:813)

            jjg Jonathan Gibbons
            anazarov Andrey Nazarov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: