NPE in FlowAnalyzer.visitApply (com.sun.tools.javac.code.Type.getThrownTypes()" because "tree.meth.type" is null)

Dawid Weiss dawid.weiss at gmail.com
Fri Jun 11 09:36:23 UTC 2021


I get this simple snippet to fail the compiler on JDK 14 all the way
up to 16.0.1/ 2021-04-20:

import com.google.inject.Guice;
import com.google.inject.Key;
import com.google.inject.TypeLiteral;

import java.lang.annotation.Retention;
import java.util.LinkedHashSet;

public class Repro {
  public static void main(String[] args) {
    LinkedHashSet<String> fieldSet =
        Guice.createInjector().getInstance(Key.get(new TypeLiteral<>()
{}, Retention.class));
  }
}

Couldn't isolate it without using Guice JAR - it's probably trivial,
sorry. The full repro is at [1] and you can run it with:

javac -cp guice-5.0.1.jar Repro.java

I see some NPE related issues marked as fixed in jira but this seems
to be unrelated (as it still causes the crash).

Hope this helps.

Dawid

[1] https://github.com/dweiss/javac-bug


More information about the compiler-dev mailing list