Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8178427

NPE in Infer$CheckUpperBounds

XMLWordPrintable

    • b34

      I reproduced with 9-ea+164, and it occurs at least as far back as 9-ea+95.

      ===
      import java.util.Map;
      import java.util.concurrent.ExecutorService;
      import java.util.function.*;
      import java.util.stream.*;

      abstract class X {
        public interface N<K, V> {}

        abstract <K, V> N<K, V> c();

        abstract <T, K, V, M extends N<K, V>> Collector<T, ?, M> f(
            Function<? super T, ? extends K> k,
            Function<? super T, ? extends Stream<? extends V>> v,
            Supplier<M> multimapSupplier);

        void m(Map<String, N<?, ?>> c, ExecutorService s) {
          s.submit(() -> {
              return c.entrySet().parallelStream()
                  .collect(f(Map.Entry::getKey, e -> e.getValue().getValues(), this::c));
          });
        }
      }
      ===

      $ javac X.java
      java.lang.NullPointerException
              at jdk.compiler/com.sun.tools.javac.comp.Infer$CheckUpperBounds.apply(Infer.java:951)
              at jdk.compiler/com.sun.tools.javac.comp.Infer.doIncorporation(Infer.java:1122)
              at jdk.compiler/com.sun.tools.javac.comp.Infer$GraphSolver.solve(Infer.java:1658)
              at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.solve(InferenceContext.java:475)
              at jdk.compiler/com.sun.tools.javac.comp.InferenceContext.solve(InferenceContext.java:482)
              at jdk.compiler/com.sun.tools.javac.comp.Infer$PartiallyInferredMethodType.check(Infer.java:341)
              at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr$ResolvedMemberType.overloadCheck(ArgumentAttr.java:565)

            mcimadamore Maurizio Cimadamore
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: