Skip to content

Type argument inference crashed #7684

@cushon

Description

@cushon
import java.io.Serializable;

public class CrashRepro<T> {
  interface Consumer<T> {
    void accept(T t);
  }

  static class SerializedOp<T> {
    SerializedOp(Consumer<T> consumer) {}
  }

  static class Foo {
    <T> void bar(T t) {}
  }

  void test(Foo foo) {
    new SerializedOp<T>((Consumer<T> & Serializable) foo::bar);
  }
}
$ ~/checker-framework-4.0.0/checker/bin/javac -processor nullness CrashRepro.java
CrashRepro.java:17: error: [type.argument.inference.crashed] Type argument inference crashed for Foo.bar
    new SerializedOp<T>((Consumer<T> & Serializable) foo::bar);
                                                     ^
  error: An exception occurred: Cannot invoke "java.util.List.size()" because "args" is null
CrashRepro.java:17: error: [type.argument.inference.crashed] Type argument inference crashed for Foo.bar
    new SerializedOp<T>((Consumer<T> & Serializable) foo::bar);
                                                     ^
  error: An exception occurred: Cannot invoke "java.util.List.size()" because "args" is null
2 errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No 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