What should I do to investigate and troubleshoot a slow compilation problem?
My project has about 100 classes and takes more than 45 seconds to compi
One not so well known feature of Java 8 is Generalized Target-Type Inference.
While it allows to write clearer code, this requires more work for Javac. Sometimes this results in exponential complexity of the type inference problem. This is a known issue, but unfortunately still unresolved - see JDK-8055984, JDK-8067767.
The workaround is to compile at Java 7-compatibility level: javac -source 7, or just to use simpler constructions.