RFR: 8331081: 'internal proprietary API' diagnostics if --system is configured to an earlier JDK version

Liam Miller-Cushon cushon at openjdk.org
Thu May 2 21:20:51 UTC 2024


On Thu, 2 May 2024 20:32:43 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> Traditionally, I don't think javac was ever (supposed to) produce these warnings when the system classes where overridden (using `-bootclasspath` in JDK <9, and `--system` in JDK >= 9).
> 
> I believe the idea was that when someone provides their own the system classes, we shall not produce a warning based on some hardcoded knowledge, which may or may not be relevant for the externally provided system classes. That might be overly cautious, especially given that since JDK 9, it is only about `jdk.unsupported`, and it is harder to imagine a usecase where the warning would not be reasonable for that module.

Understood, thanks. The motivation here is that I'm stuck using `--system` for some use-cases (more on that below), and all else being equal I'd like to discourage new uses of `jdk.unsupported` APIs, so supporting this diagnostic would be helpful for that.

> On the code level, I would suggest to re-organize the code so that user packages would not accumulate in `supplementaryFlags` - that seems unnecessary. If the module owning `c` is neither `noModule` nor `jdk_unsupported`, there's no point in putting anything in the map the computation, I think. (Not too terrible, but some user programs use a lot of packages.)

Thanks, I can clean that up.

> Also, I wonder why not simply use `--release 11`. The set of usecases for which `--system` needs to be used instead of `--release`, and for which the warning is important seems quite limited to me.

`--release` can't be used together with `--add-exports=`, and can't be used to compile code that uses internal APIs for Java 8 and earlier ([JDK-8206937](https://bugs.openjdk.org/browse/JDK-8206937)). That use-case may be limited and I understand that at least the first part is deliberate, but that's use-case for `--system` I have.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/19069#issuecomment-2091667031


More information about the compiler-dev mailing list