Skip to content

Improve nullability for getSession(*) in MockHttpServletRequest #36926

Closed

Description

@OrangeDog

MockHttpServletRequest.getSession() will always create a new session if there isn't one, and so can never return null.

Similarly, getSession(boolean) should have a @Contract("true -> !null").

Activity

  1. added
    status: waiting-for-triage
    on Jun 15, 2026
  2. added
    in: test
    in: web
    on Jun 15, 2026
  3. self-assigned this
    on Jun 15, 2026
  4. added
    type: enhancement
    and removed
    status: waiting-for-triage
    on Jun 15, 2026
  5. changed the title [-]MockHttpServletRequest.getSession() is incorrectly marked @Nullable[/-] [+]Improve nullability for `MockHttpServletRequest.getSession()`[/+] on Jun 15, 2026
  6. added this to the 7.0.9 milestone on Jun 15, 2026
  7. sbrannen commented on Jun 15, 2026

    @sbrannen
    Member

    Good catch! 👍

    We'll sort this out for 7.0.9.

  8. changed the title [-]Improve nullability for `MockHttpServletRequest.getSession()`[/-] [+]Improve nullability for `getSession(*)` in `MockHttpServletRequest`[/+] on Jun 15, 2026
  9. added a commit that references this issue on Jun 15, 2026
    292959e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: testin: webtype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions