It's Oracle's intent that these classes be inaccessible at compile-time.
See the response to this javac bug report.
For a likely solution, see Using internal sun classes with javac . The javac -XDignore.symbol.file
switch should fix this - but I'm a gradle newb, and don't see how to feed this to gradle's JavaCompile. My best guess is
apply plugin: 'java'
compileJava.options.useAnt = true
compileJava.options.compilerArgs << "-XDignore.symbol.file"
Incidentally, ct.sym (referred to in the link) appears to be a jar-file that lists, as class stubs, all the accessible classes.