GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Crash when a diamond is in a lambda · Issue #8047 · typetools/checker-framework

Crash when a diamond is in a lambda #8047

New issue
Copy link
New issue
Copy link
Closed
#8049
Closed
Crash when a diamond is in a lambda#8047
#8049
Copy link
Assignees
smillst
Labels
crash

Description

@smillst
smillst
opened on Aug 24, 2026
Issue body actions

The following was reduced from a crash in Beam.

import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * A diamond {@code new Adapter<>(...)} appearing in a lambda body, where {@code Adapter} is the
 * enclosing class and so its type variable {@code T} is in scope, crashed inference in {@code
 * StructuralEqualityComparer} with "unexpected combination". Reduced from Apache Beam's {@code
 * UnboundedReadFromBoundedSource.BoundedToUnboundedSourceAdapter.split}.
 */
public class DiamondInLambdaCrash {

  static class Adapter<T> {
    Adapter(T t) {}

    List<Adapter<T>> viaStream(Stream<T> s) {
      return s.map(input -> new Adapter<>(input)).collect(Collectors.toList());
    }

    List<Adapter<T>> viaList(List<T> l) {
      return l.stream().map(input -> new Adapter<>(input)).collect(Collectors.toList());
    }

    // Spelling out the type argument instead of using a diamond did not crash.
    List<Adapter<T>> explicitTypeArgument(Stream<T> s) {
      return s.map(input -> new Adapter<T>(input)).collect(Collectors.toList());
    }
  }

  // The same shape without any JDK stream classes.

  interface Str<E> {
    <R> Str<R> map(Function<? super E, ? extends R> f);

    <X> X collect(Coll<? super E, X> c);
  }

  interface Coll<E, X> {}

  static <Y> Coll<Y, List<Y>> toList() {
    throw new RuntimeException();
  }

  static class Wrapper<T> {
    Wrapper(T t) {}

    List<Wrapper<T>> f(Str<T> s) {
      return s.map(input -> new Wrapper<>(input)).collect(toList());
    }
  }

  // The diamond class differing from the enclosing class did not crash.
  static class Other<T> {}

  static class Holder<T> {
    List<Other<T>> f(Stream<T> s) {
      return s.map(input -> new Other<T>()).collect(Collectors.toList());
    }
  }
}

Activity

  1. smillst
    self-assigned this
    on Aug 24, 2026
  2. smillst
    added
    crash
    on Aug 24, 2026
  3. mernst
    closed this as completedin #8049on Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @smillst
    smillst

Labels

crash

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.