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

Null-safety error related to superclass and varargs in Spring #1113

Closed
sdeleuze opened this issue Dec 24, 2024 · 2 comments · Fixed by #1116
Closed

Null-safety error related to superclass and varargs in Spring #1113

sdeleuze opened this issue Dec 24, 2024 · 2 comments · Fixed by #1116
Labels
bug jspecify Related to support for jspecify standard (see jspecify.dev)

Comments

@sdeleuze
Copy link

In org.springframework.cache.interceptor null-marked package:

  • KeyGenerator defines a method with a @Nullable Object... params parameter
  • SimpleKeyGenerator overrides this method with the same @Nullable Object... params

This error is reported by NullAway, looks like a bug to me:

  /Users/sdeleuze/workspace/spring-framework/spring-context/src/main/java/org/springframework/cache/interceptor/SimpleKeyGenerator.java:46:
error: [NullAway] parameter params is @NonNull, but parameter in superclass method org.springframework.cache.interceptor.KeyGenerator.generate(java.lang.Object,java.lang.reflect.Method,java.lang.Object...) is @Nullable
        public Object generate(Object target, Method method, @Nullable Object... params) {
                                                                                 ^
      (see http://t.uber.com/nullaway )
  1 error
@ben-manes
Copy link

I think it’s related to #1091 / #1094 when I went through a similar migration. For now I suppressed those cases as false positives.

@msridhar
Copy link
Collaborator

I think this is actually distinct from #1091 / #1094 and related directly to method overrides, varargs, and JSpecify annotations. Working on a fix.

@msridhar msridhar added bug jspecify Related to support for jspecify standard (see jspecify.dev) labels Dec 25, 2024
msridhar added a commit that referenced this issue Dec 26, 2024
Fixes #1113 

We weren't calling the right API to check the nullability of a varargs
argument when checking valid overriding. Most of this PR is tests to
check handling of most of the cases.
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Jan 7, 2025
This commit removes warning suppressions related to uber/NullAway#1113
which is now fixed.

See spring-projectsgh-28797
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue Jan 7, 2025
This commit removes warning suppressions related to uber/NullAway#1113
which is now fixed.

See spring-projectsgh-28797
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug jspecify Related to support for jspecify standard (see jspecify.dev)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants