typetools / typetools/checker-framework

type.argument warning when assigning to explicitly retyped type with wildcard parameters

Open
#7,210 2 comments 0 reactions 1 assignee View on GitHub

@smillst is already working on this.

Since Aug 23, 2025.

False Positive (false warning or imprecision)
Dominant language
Java
Stars
1.1k
Forks
440
Avg merge
1d 12h
Merged PRs (30d)
134

Description

using checker 3.49.5

Following code

public class Test<T, L extends List<@Nullable T>> {

  void method(Object x) {
    Test<?, ?> y = (Test<?, ?>) x;
  }
}

produces warning

java: [type.argument] incompatible type argument for type parameter L of Test.
  found   : capture#01[ extends @Initialized @NonNull List<capture#02[ extends @Initialized @Nullable Object super @Initialized @NonNull Void]> super @Initialized @NonNull Void]
  required: @Initialized @NonNull List<capture#02[ extends @Initialized @Nullable Object super @Initialized @Nullable Void]>

I believe there is no reason for warning

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.