Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress Java warning "Unsafe is internal proprietary API" in Groovy project build with Gradle

I've have a Groovy project built with Gradle (1.8) in which some Java classes report the following compiler warning message:

warning: Unsafe is internal proprietary API and may be removed in a future release
import sun.misc.Unsafe;

Is there a way to suppress that error message? I've found some answers suggesting to use the javac compiler option -XDignore.symbol.file but I'm unable to apply it in the Gradle build when using the Groovy plugin.

Any solution ?

Thanks

like image 610
pditommaso Avatar asked Oct 23 '13 22:10

pditommaso


1 Answers

Add following to your gradle.build file

compileJava {
    options.compilerArgs << '-XDignore.symbol.file'
    options.fork = true // may not needed on 1.8
    options.forkOptions.executable = 'javac' // may not needed on 1.8
}

fork is required on gradle 1.6, not sure about 1.8 update: it's still required on 1.8

like image 51
Viktor Aseev Avatar answered Oct 22 '22 15:10

Viktor Aseev