<div dir="ltr">I agree that it is a good choice to use -release or set bootclasspath. However, this is not always realistic.<div><br></div><div>Using -release means that we will encounter many JPMS problems.<br></div><div>For example, using --add-exports for system modules is not allowed when using -release.<br></div><div><br></div><div>In addition, sometimes we may want to deliberately bypass the restriction of -release:<br></div><div>We may use some new APIs of higher Java versions in our code. <br></div><div>As long as we check the Java version at runtime and ensure that the code path is not executed </div><div>when running on a lower version of Java, this is also reasonable.<br></div><div><br></div><div>For setting bootclasspath... Well, although I know it should be like this in theory, I've never seen anyone set it.<br></div><div>Since I have installed the corresponding version of JDK, why don't I compile with it directly?<br></div><div><br></div><div>Let's return to this issue. Whether use -release or set bootclasspath, I think it's just a workaround.<br></div><div>Whether the compiler will check this problem or not, it is our original task to let users and static analysts </div><div>understand this problem from the document.<br></div><div>I think there is no doubt that the lack of @since is an oversight.<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Dec 31, 2022 at 2:42 AM Joe Darcy <<a href="mailto:joe.darcy@oracle.com">joe.darcy@oracle.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 12/30/2022 4:12 AM, Glavo wrote:<br>
> Java 9 overrides the rewind, flip and other methods of Buffer in <br>
> subclasses of Buffer such as ByteBuffer.<br>
> The methods in these subclasses do not add @since 9 to javadoc.<br>
><br>
> I think this is an oversight, because this modification destroys some <br>
> code.<br>
> When compiling them with JDK 9+ and using the -target 8 option instead <br>
> of -release 8,<br>
> the generated class file crashes when running in Java 8.<br>
<br>
Which is exactly why compiling with "javac -source $OLD -target $OLD" <br>
*without* setting the bootclasspath was not a recommended option and <br>
started generating a warning as of JDK 7:<br>
<br>
<a href="https://web.archive.org/web/20101225145622/http://blogs.sun.com/darcy/entry/bootclasspath_older_source" rel="noreferrer" target="_blank">https://web.archive.org/web/20101225145622/http://blogs.sun.com/darcy/entry/bootclasspath_older_source</a><br>
<br>
><br>
> IDEs cannot detect this error because there is no @since document.<br>
> Therefore, I think it is important to add @since to them, and they <br>
> need to be back ported to Java 11/17.<br>
<br>
<br>
The solution to a misconfigured build is to configure the build <br>
properly, which includes using --release $FOO where available.<br>
<br>
-Joe<br>
<br>
</blockquote></div>