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 am using the gradle plugin, which now when updated to 0.6.39 now by default uses Checker Framework version 3.43.0, and we got some new errors with this. The only enabled checker is "org.checkerframework.checker.formatter.FormatterChecker". This is with Java 21, if that makes any kind of difference.
In particular, we have issues with the format checker, when using Map.of. When first declaring a new HashMap<String, String>(), the issue goes away.
None of these solutions truly resolve the issue when having less trivial cases, such as when the receiving function is a generic and the values of the map is mixed, for example:
which while technically possible to specify, it would be incredibly cumbersome.
Reverting to 3.42.0 also makes it go away, so I assume it's related to the type inference changes.
Is this intended behavior? We use Map.of extensively in our code base, and have a few cases where we call library code that takes either Map<String, T> or Map<String, ?>. We're currently leaning towards disabling the format checker instead, which would be unfortunate.
The text was updated successfully, but these errors were encountered:
I am using the gradle plugin, which now when updated to 0.6.39 now by default uses Checker Framework version 3.43.0, and we got some new errors with this. The only enabled checker is
"org.checkerframework.checker.formatter.FormatterChecker"
. This is with Java 21, if that makes any kind of difference.In particular, we have issues with the format checker, when using Map.of. When first declaring a
new HashMap<String, String>()
, the issue goes away.In short, the following code produces an error:
The error we get is:
However, the following code builds and runs fine:
When manually specifying the format, it also works, but of course won't be a solution when calling library code.
Manually specifying the type of the map also works:
None of these solutions truly resolve the issue when having less trivial cases, such as when the receiving function is a generic and the values of the map is mixed, for example:
produces the error
which while technically possible to specify, it would be incredibly cumbersome.
Reverting to 3.42.0 also makes it go away, so I assume it's related to the type inference changes.
Is this intended behavior? We use
Map.of
extensively in our code base, and have a few cases where we call library code that takes either Map<String, T> or Map<String, ?>. We're currently leaning towards disabling the format checker instead, which would be unfortunate.The text was updated successfully, but these errors were encountered: