Patching package-info.java files

Antonio Cortes Perez antoniocortes at google.com
Tue Feb 19 22:58:54 UTC 2019


Perfect! -XpkgInfo explains this behavior. The package-info does not have
any annotations with runtime or class retention policy. Thanks!

Test case:
$ mkdir -p src/java.base/java/util/
download
https://raw.githubusercontent.com/AdoptOpenJDK/openjdk-jdk11/master/src/java.base/share/classes/java/util/package-info.java
$ mv package-info.java src/java.base/java/util/
$ javac --patch-module java.base=src -d out
src/java.base/java/util/package-info.java
No class file generated.
$ javac --patch-module java.base=src -d out -Xpkginfo:always
src/java.base/java/util/package-info.java
Class file generated.

On Tue, Feb 19, 2019 at 1:53 PM Jonathan Gibbons <
jonathan.gibbons at oracle.com> wrote:

> Have you tried using the -XpkgInfo option?  If so, did that fix the issue?
>
>    -Xpkginfo:{always,legacy,nonempty}
>          Specify handling of package-info files
>
> Can you provide a simple test case?
>
> -- Jon
>
> On 02/19/2019 01:21 PM, Antonio Cortes Perez wrote:
> > Hi,
> >
> > I am able to patch system module files using these instructions (I am
> > using jdk-11.0.1).
> > 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 files. Is this by design?
> >
> > javac --patch-module java.base=src -d mypatches/java.base \
> > src/java.base/java/util/concurrent/package-info.java
> >
> > Thanks!
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20190219/e3e826ca/attachment-0001.html>


More information about the compiler-dev mailing list