java 10 compilaton Null Pointer Exception

It is a reported unresolved bug. The bug is planned to be resolved in jdk 11.

JDK-8203195-Anonymous class type inference results in NPE

Type:                 Bug
Status:               In Progress
Priority:             P2
Resolution:           Unresolved
Affects Version/s:    9, 10, 10.0.1, 11
Fix Version/s:        11
Component/s:          tools
Labels:               dcsfai reproducer-yes webbug 

Subcomponent:         javac
CPU:                  generic   
OS:                   generic

https://bugs.openjdk.java.net/projects/JDK/issues/JDK-8203195?filter=allopenissues

However, there is a work around mentioned in the bug description which states:

Interestingly, changing A.java to do the following:
Object baz => foo.foo(new B<Object>() {});
or changing foo/B.java to the following:

 package foo;

 public class B<T> {

 B(int baz) {   }

 protected B() {   } 
 }

results in a successful compilation.