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
Note: The Checker Framework is tested with JDK 8, 11, 17, and 21. You are using version 22.
Test.java:12: error: [methodref.param.invalid] Incompatible parameter type for arg0
.collect(collector(ids::get, i -> new Object()));
^
found : @NonNull int
required: /*INFERENCE FAILED for:*/ ? extends @Nullable Object
Consequence: method in @NonNull List<@NonNull String>
@NonNull String get(@NonNull List<@NonNull String> this, @NonNull int p0)
is not a valid method reference for method in @NonNull Function</*INFERENCE FAILED for:*/ ? extends @Nullable Object, @NonNull String>
@NonNull String apply(@NonNull Function</*INFERENCE FAILED for:*/ ? extends @Nullable Object, @NonNull String> this, /*INFERENCE FAILED for:*/ ? extends @Nullable Object p0)
1 error
notes
Can be fixed by replacing ids::get with i -> ids.get(i)
The text was updated successfully, but these errors were encountered:
lpgong
changed the title
Type inference failure with lambda function reference
Type inference failure when using lambda function reference
Jun 6, 2024
Tested with latest release 3.42.0-eisop3.
commands
./checker/bin/javac -processor nullness Test.java
inputs
Test.java
outputs
notes
Can be fixed by replacing
ids::get
withi -> ids.get(i)
The text was updated successfully, but these errors were encountered: