Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move JSpecify from provided to compile scope #3228

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from

Commits on Nov 22, 2024

  1. Move JSpecify from provided to compile scope

    [JSpecify](https://jspecify.dev/) is a nullability annotation library with a
    [large list of supporters](https://jspecify.dev/about/).
    It is the recommended library to solve
    [LOG4J2-1477](https://issues.apache.org/jira/browse/LOG4J2-1477).
    
    The usage of JSpecify as `provided` library has however a drawback: if users don't have JSpecify on their stack, they'll get a Javac Linter warning whenever they use a class with nullability annotations
    (see [#3110](#3110) for example.
    Since JSpecify is an annotation with `RUNTIME` retention and is not covered by
    [JDK-8342833](https://bugs.openjdk.org/browse/JDK-8342833), the easiest solution provided by this PR is:
    
    - Move JSpecify from the `provided` to the `compile` scope. This will inflate users dependency stack by a whooping 4000 bytes.
    - Mark JSpecify as optional for OSGi and JPMS, so users can exclude the dependency if they wish to do it.
    
    In practice, this change should be neutral for users and will allow us to add nullability annotations to important class, such as `Logger` without breaking the build of users that use the [`-Werror` compiler flag](https://docs.oracle.com/en/java/javase/17/docs/specs/man/javac.html#option-Werror).
    ppkarwasz committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    51cf323 View commit details
    Browse the repository at this point in the history