Skip to content

Cannot infer type arguments #7364

@jpschewe

Description

@jpschewe

Checker version 3.52.0.
Java version: 21.0.8

To reproduce:

  1. mkdir -p net/mtu/eggplant/checker/
  2. cd net/mtu/eggplant/checker/
  3. tar -xzf type_arguments.tar.gz

Build this with checker. Result is

/home/jpschewe/projects/checker-bugs/src/main/java/net/mtu/eggplant/checker/type_arguments/Test.java:16: error: [type.arguments.not.inferred] Could not infer type arguments for Predicate.not
                                                   .filter(Predicate.not(AbstractGoal::isComputed)) //
                                                                        ^
  unsatisfiable constraint: @Initialized @PolyNull AbstractGoal <: @Initialized @NonNull AbstractGoal
  @Initialized @PolyNull AbstractGoal <: use of T from Predicate.not(AbstractGoal::isComputed)
  From complementary bound.: use of T from Predicate.not(AbstractGoal::isComputed) <= ? extends @Initialized @Nullable Object super @Initialized @PolyNull AbstractGoal
  inference type: java.util.function.Predicate<T> <: @Initialized @NonNull Predicate<? extends @Initialized @Nullable Object super @Initialized @PolyNull AbstractGoal>
  inference type: java.util.function.Predicate<T> -> @Initialized @NonNull Predicate<? extends @Initialized @Nullable Object super @Initialized @PolyNull AbstractGoal>
  From: Constraint between method call type and target type for method call:Predicate.not(AbstractGoal::isComputed)
/home/jpschewe/projects/checker-bugs/src/main/java/net/mtu/eggplant/checker/type_arguments/Test.java:18: error: [methodref.receiver] Incompatible receiver type
                                                   .anyMatch(Goal::isRequired);
                                                             ^
  found   : @Initialized @NonNull Goal
  required: @Initialized @PolyNull Goal
  Consequence: method in @Initialized @NonNull Goal
    @Initialized @NonNull boolean isRequired(@Initialized @NonNull Goal this)
  is not a valid method reference for method in @Initialized @NonNull Predicate<@Initialized @PolyNull Goal>
    @Initialized @NonNull boolean test(@Initialized @NonNull Predicate<@Initialized @PolyNull Goal> this, @Initialized @PolyNull Goal p0)
2 errors

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions