gradle/gradle — pull request #238 by GregoryBevan (2014-01-22 21:42:36+00:00)
Title: Catch IllegalAccessError exception to prevent Eclipse hang while creating Gradle daemon

When using both Lombok and Gradle plugin integration, Eclipse hangs on the build model task.

The following bugs from STS issue tracker describe the problem :

https://issuetracker.springsource.com/browse/STS-3419
https://issuetracker.springsource.com/browse/STS-3495

After debugging the Gradle Toolong API, I see that an IllegalAccessError exception occurred while invoking the code : ProcessParentingInitializer.intitialize();

Here is the exception message :

Caused by: java.lang.IllegalAccessError: tried to access method com.sun.jna.Pointer.(J)V from class org.gradle.internal.nativeplatform.jna.Kernel32
at org.gradle.internal.nativeplatform.jna.Kernel32.(Kernel32.java:40)
at org.gradle.internal.nativeplatform.jna.WindowsHandlesManipulator.uninheritStandardStreams(WindowsHandlesManipulator.java:41)
at org.gradle.process.internal.ProcessParentingInitializer$2.create(ProcessParentingInitializer.java:75)
at org.gradle.internal.concurrent.Synchronizer.synchronize(Synchronizer.java:31)
at org.gradle.process.internal.ProcessParentingInitializer.intitialize(ProcessParentingInitializer.java:67)
at org.gradle.process.internal.ProcessParentingInitializer.intitialize(ProcessParentingInitializer.java:42)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:62)

I haven't found the problem origin but it seems to be linked with classloading.

If the exception is caught, Eclipse doesn't hang. An error message is displaye. The gradle plugin works well thereafter.