GRADLE-2836 - make class generation thread safe.