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

Symlinks can't point outside module-source-path

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 16, 17
    • tools

      The following compiles fine:

      mod
      |--- module-info.java // contents: 'module mod {}'
      |--- pkg
            |--- C.java // contents: 'package pkg; public class C {}'
      classes

      > javac -m mod --module-source-path . -d classes
      # success

      But if I replace the source directory with a symlink, javac complains about the source file location:

      mod
      |--- module-info.java // contents: 'module mod {}'
      |--- pkg // symlink to ../pkg
      pkg
      |--- C.java // contents: 'package pkg; public class C {}'
      classes

      > javac -m mod --module-source-path . -d classes
      ./mod/pkg/C.java:1: error: not in a module on the module source path
      package pkg;
      ^
      1 error

      I'd expect this error check to be performed against the source file's relative path (or some other symlink-preserving form of its path), not its canonical path, allowing the source tree to compile without error. Or, since the source was located by javac itself by crawling the file system, perhaps the check can be skipped entirely.

            jlahoda Jan Lahoda
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: