The javadocs of some methods in NIO Buffer are missing @since

Joe Darcy joe.darcy at oracle.com
Fri Dec 30 18:42:28 UTC 2022


On 12/30/2022 4:12 AM, Glavo wrote:
> Java 9 overrides the rewind, flip and other methods of Buffer in 
> subclasses of Buffer such as ByteBuffer.
> The methods in these subclasses do not add @since 9 to javadoc.
>
> I think this is an oversight, because this modification destroys some 
> code.
> When compiling them with JDK 9+ and using the -target 8 option instead 
> of -release 8,
> the generated class file crashes when running in Java 8.

Which is exactly why compiling with "javac -source $OLD -target $OLD" 
*without* setting the bootclasspath was not a recommended option and 
started generating a warning as of JDK 7:

https://web.archive.org/web/20101225145622/http://blogs.sun.com/darcy/entry/bootclasspath_older_source

>
> IDEs cannot detect this error because there is no @since document.
> Therefore, I think it is important to add @since to them, and they 
> need to be back ported to Java 11/17.


The solution to a misconfigured build is to configure the build 
properly, which includes using --release $FOO where available.

-Joe



More information about the core-libs-dev mailing list