[BUG] nullability annotations - JSR 305 is legally problematic

Started by vanzomerenc, July 31, 2024, 22:12:58

Previous topic - Next topic

vanzomerenc

LWJGL uses nullability annotations from JSR 305, which appears to have died a very long time ago without an official implementation, or even a draft of a specification.

Because the only implementation of JSR 305 is the unofficial one by the FindBugs team, and it puts annotations in a javax package, anyone who distributes it is technically violating Oracle's licensing agreement.

Google Guava has an issue that I think explains the situation pretty well: https://github.com/google/guava/issues/2960

Obviously a lot of projects are in the same boat and I don't think Oracle is going to go knocking down doors about this, but it's not great to encourage violating license terms. Is there any plan to move LWJGL to a different annotation package such as JSpecify?

spasi

Hey @vanzomerenc,

Quote from: vanzomerenc on July 31, 2024, 22:12:58Is there any plan to move LWJGL to a different annotation package such as JSpecify?
Not yet, but if JSpecify gets the expected adoption, we could migrate to it in an upcoming major release (3.4.0 or 3.5.0). Also note that jsr305 is not bundled/distributed by LWJGL. It is entirely optional and up to the user if they want to use it during development.

In the LWJGL 4 prototype I've been working on, jsr305 annotations have already been removed. The hope is that null-excluding types will be available in some form with Valhalla, which will reduce/eliminate the need for nullability annotations. Also, Java null values cannot be used with Panama for NULL pointers, you have to use MemorySegment.NULL instead. This alone removes 99% of @Nullable annotations in the LWJGL API.

vanzomerenc

Quote from: spasi on August 01, 2024, 11:17:06Not yet, but if JSpecify gets the expected adoption, we could migrate to it in an upcoming major release (3.4.0 or 3.5.0).

That is very encouraging to hear. If it's a matter of having someone to do the work, I'd be willing to do it.

It's also excellent to hear that the Valhalla and/or Panama projects will eventually make this whole issue irrelevant.

spasi