Skip to content

Type variables and wildcards nullability #7346

@beikov

Description

@beikov

I tried to simplify a problem that I have in my code base with the type checking of Checker Framework. Here is the Java code:

	interface Base<A, B extends A> {}
	static class Sub<A, B extends A> implements Base<A, B> {}
	static class Main {
		List<Base<?,?>> list;
	}

and this is the error I get when compiling.

error: [type.argument] incompatible type argument for type parameter B of Base.
                List<Base<?,?>> list;
                            ^
  found   : @Initialized @NonNull Object
  required: capture#01 extends @Initialized @Nullable Object

How am I supposed to annotate this to "just work" correctly?

Might be related to #7210

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions