You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(I included the redundant extends @NonNull Object above so that I could make a fairer comparison to typetools, which AFAIK doesn't yet recognize the effect of @NullMarked on type-parameter declarations. The issue reproduces even without that (and also with just extends Object).)
checker-framework-3.42.0-eisop4 $ checker/bin/javac -cp $HOME/.m2/repository/org/jspecify/jspecify/1.0.0/jspecify-1.0.0.jar -processor nullness Foo.java FooParent.java TestClass.java -AconservativeUninferredTypeArguments
Note: The Checker Framework is tested with JDK 8, 11, 17, and 21. You are using version 22.
This happens only when using the diamond operator: If we instead specify an explicit type argument V, we get an error (even without -AconservativeUninferredTypeArguments):
TestClass.java:7: error: [type.argument.type.incompatible] incompatible type argument for type parameter V of Foo.
return new Foo<V>();
^
found : V extends @Nullable Object
required: @NonNull Object
1 error
typetools likewise gets this wrong at 3.42.0. It gets it right by 3.45.0 (I didn't check versions in between), I assume as a result of the type-inference revamp:
TestClass.java:7: error: [type.arguments.not.inferred] Could not infer type arguments for Foo constructor
return new Foo<>();
^
unsatisfiable constraint: V extends @Initialized @Nullable Object <: @Initialized @NonNull Object
1 error
My expectation would be that eisop would start working once it picks up the type-inference changes. I am filing this issue anyway just in case it's of interest. (I at least found it surprising that -AconservativeUninferredTypeArguments didn't help, though again, that's the case in typetools, too.)
The text was updated successfully, but these errors were encountered:
(I included the redundant
extends @NonNull Object
above so that I could make a fairer comparison to typetools, which AFAIK doesn't yet recognize the effect of@NullMarked
on type-parameter declarations. The issue reproduces even without that (and also with justextends Object
).)This happens only when using the diamond operator: If we instead specify an explicit type argument
V
, we get an error (even without-AconservativeUninferredTypeArguments
):typetools likewise gets this wrong at 3.42.0. It gets it right by 3.45.0 (I didn't check versions in between), I assume as a result of the type-inference revamp:
My expectation would be that eisop would start working once it picks up the type-inference changes. I am filing this issue anyway just in case it's of interest. (I at least found it surprising that
-AconservativeUninferredTypeArguments
didn't help, though again, that's the case in typetools, too.)The text was updated successfully, but these errors were encountered: