Skip to content

Remove compiler warnings #18405

@rwinch

Description

@rwinch

We should remove the compiler warnings in the build.

Guidance

If you would like to help, please select a sub-issue and comment on the issue, so that it can be assigned to you. There is no need to wait for a reply if you were the first person to request the issue, then it is yours and you can work on it and send a pull request.

Finding compiler warnings

You can find the compiler warnings by running all of the compile tasks within the module. Ensure to run compilation for main java and kotlin and test java and kotlin. An easy way to do this is to run the check task for the specific module. For example, with the core module you can run:

./gradlew --no-build-cache clean :spring-security-core:check

Look through the output for any warnings specific to that module (it may cause other modules to build too)

Deprecations

If there are deprecation warnings, then you should use this as guidance.

  • If there is a deprecation being used, we should only suppress it if the method itself is deprecated.
  • Adding additional deprecations should not be done blindly though (perhaps we should adapt the code to work in a non-deprecated way).
  • Tests need to continue testing deprecated methods and thus can have suppress added along with new tests with the replacement method (if it doesn't exist)

Configure Error on Warning

After you have fixed the compilation warnings, configure the module to error on warning. The first project should create a new Pre-compiled Script Plugin at buildSrc/src/main/groovy/javadoc-warnings-error.gradle at buildSrc/src/main/groovy/compile-warnings-error.gradle that configures the compilers (for main and test, java and kotlin) to fail on warnings. Subsequent projects should just apply this plugin.

Questions

If you have questions, feel free to reach out on your specific issue. We will update the instructions as we go.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions