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

FileManager.getLocation(StandardLocation.MODULE_SOURCE_PATH) is unsupported

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 9
    • Fix Version/s: None
    • Component/s: tools
    • Labels:

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jjg Jonathan Gibbons
                Reporter:
                anazarov Andrey Nazarov
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: