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

javac -Xmodule compiles the module in a way that reads the unnamed module

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • tools
    • b135
    • Verified

      Consider the following command:
          javac -Xmodule:m -p mods -cp lib/junit-4.12.jar test/m/p/MyTest.java

      which compiles a test "as if" part of module m (module m has already been compiled to mods/m).

      module m is very simple:

      src/m/module-info.java:

      module m {
          exports p;
      }

      src/m/p/Main.java:

      package p;
      public class Main { }


      test/m/p/MyTest.java is:

      package p;
      import org.junit.Test;
      import static org.junit.Assert.*;
      public class MyTest {
          @Test
          public void testSomething() {
      assertTrue(true);
          }
      }

      Note that the test has references to JUnit tests that are on the class path.

      It's not clear how this test compiled successful. It appears that when compiling with -Xmodule that the module is made to read the unnamed module. I can't otherwise explain it.




            jlahoda Jan Lahoda
            jlahoda Jan Lahoda
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: