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

Fix SimpleMailMessage nullability annotations #29139

Closed
wants to merge 2 commits into from

Commits on Sep 13, 2022

  1. Fix SimpleMailMessage nullability annotations

    Fixes the nullability annotations in `SimpleMailMessage` so the
    `set*(...)` methods have their parameters marked as `@Nullable`.
    
    These method parameters had no annotations and when `SimpleMailMessage`
    is used from Kotlin with `-Xjsr305=strict` enabled, the `set*(...)`
    methods were treated as being marked `@NonNull`. This also meant Kotlin
    would not see matched pairs of get/set methods as `var` properties, so
    calling `message.text = "Text"` would not compile in Kotlin.
    
    Adds tests in `SimpleMailMessageJsr305ComplianceTests.kt` that verify
    the nullability annotations for `SimpleMailMessage` are correct. This
    file will actually fail to compile if the nullability annotations are
    missing, causing the tests to fail.
    
    Also modifies `spring-context-support.gradle` to force the Kotlin test
    code to compile with `-Xjsr305=strict`, enabling the test code to work
    properly.
    stgerhardt committed Sep 13, 2022
    Copy the full SHA
    d93e30e View commit details
    Browse the repository at this point in the history
  2. Fix SimpleMailMessage nullability annotations

    Improves test code in `SimpleMailMessageJsr305ComplianceTests.kt`. Adds
    more comments and greatly simplified the unsafe vararg call helper
    function compared to its initial implementation. Adds a few extra tests
    as well.
    stgerhardt committed Sep 13, 2022
    Copy the full SHA
    4974575 View commit details
    Browse the repository at this point in the history