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

Capture conversion forgets annotation #3754

Closed
mernst opened this issue Oct 8, 2020 · 0 comments · Fixed by #3922
Closed

Capture conversion forgets annotation #3754

mernst opened this issue Oct 8, 2020 · 0 comments · Fixed by #3922
Assignees

Comments

@mernst
Copy link
Member

mernst commented Oct 8, 2020

For this code:

import org.checkerframework.checker.nullness.qual.Nullable;

class Issue3754 {
  interface Supplier<T extends @Nullable Object, U extends T> {
    U get();
  }

  Object x(Supplier<? extends Object, ?> bar) {
    return bar.get();
  }
}

the Nullness Checker issues this warning:

Issue3754.java:9: error: [return.type.incompatible] incompatible types in return.
    return bar.get();
                  ^
  type of expression: ? extends capture#519 of ? extends java.lang.Object extends @Initialized @Nullable Object
  method return type: @Initialized @NonNull Object

I think the code should type-check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants