0

I am able to patch system module files using these instructions. https://openjdk.java.net/projects/jigsaw/quick-start#xoverride

When trying the same command to patch a package-info.java, the package-info.class file is not generated if the patched version has the same contents as the version in the module. But this behavior does not apply to non-package-info java files.

javac --patch-module java.base=src -d mypatches/java.base \ src/java.base/java/util/concurrent/package-info.java

In my original question I mentioned the following error:

package-info.java:2: error: package exists in another module: java.base

I am still trying to create a toy example to reproduce this error. The main difference is that I am using a custom system module (--system) when I get this error.

Antonio
  • 88
  • 6

1 Answers1

1

JEP 261 introduces --patch-module as applying to class files, so it could apply to package-info.class, too. But then it continues

The effect of each instance is to change how the module system searches for a type in the specified module.

Since package-info does not define a type, the above sentence implies that --patch-module has no effect on package-info.

Still, I believe the exact error message given is an accidental artifact of under specified behavior, as if package-info.java was compiled as being associated to the unnamed package despite being on the patch path.

Stephan Herrmann
  • 7,963
  • 2
  • 27
  • 38
  • It is possible to patch package-info.java files. I updated my question after experimenting a bit more. I'll update this question if I get any tips from the openjdk compiler-dev mailing list. – Antonio Feb 19 '19 at 21:34