Skip to content

JSpecify: work around missing type annotations in cast expression types #1022

Closed

Description

@msridhar

E.g., for this:

Object o = ...;
var x = (A<@Nullable String>) o;

The type of (A<@Nullable String>) o provided by javac is A<String>, not A<@Nullable String>. We should work around this.

Activity

  1. added
    jspecify
    on Aug 19, 2024
  2. changed the title [-]JSpecify: work around missing type annotations in (some?) `var`-declared variables[/-] [+]JSpecify: work around missing type annotations in cast expressions[/+] on Aug 19, 2024
  3. changed the title [-]JSpecify: work around missing type annotations in cast expressions[/-] [+]JSpecify: work around missing type annotations in cast expression types[/+] on Aug 19, 2024
  4. msridhar commented on Aug 22, 2024

    @msridhar
    ContributorAuthor

    This issue is fixed in JDK 24-ea, but most likely we should still implement a workaround in NullAway.

  5. msridhar commented on Sep 8, 2024

    @msridhar
    ContributorAuthor

    From my testing, it looks like this is also fixed in the latest JDK 23 release candidate. FYI @cpovirk

  6. msridhar commented on Aug 31, 2025

    @msridhar
    ContributorAuthor

    This issue diagnosed the problem incorrectly; see #1266.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    jspecify

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions