-
Notifications
You must be signed in to change notification settings - Fork 510
Closed
Labels
Description
Hi,
I have recently started using VSCode with your extension for a Gradle project, however I come across the "Access restriction" error which was flagged in other issues (#120 and #219). I have tried the proposed solution in those threads but without any luck so far.
Below are few errors that I got:
Access restriction: The type 'Signal' is not API (restriction on required library 'C:\Program Files\JAVA\openjdk11.0.5\lib\jrt-fs.jar'); code: 16777523;
Access restriction: The method 'HttpExchange.getRequestHeaders()' is not API (restriction on required library 'C:\Program Files\JAVA\openjdk11.0.5\lib\jrt-fs.jar'); code: 16777523;
And they are primarily from the below library import:
import sun.misc.Signal;
import sun.misc.SignalHandler;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
I have integrated below access rule into my build.gradle:
import org.gradle.plugins.ide.eclipse.model.AccessRule
apply plugin: 'java'
apply plugin: 'eclipse'
eclipse {
classpath {
file {
whenMerged {
def jre = entries.find { it.path.contains 'org.eclipse.jdt.launching.JRE_CONTAINER' }
jre.accessRules.add(new AccessRule('accessible', 'sun/misc/**'))
jre.accessRules.add(new AccessRule('accessible', 'com/sun/net/**'))
}
}
}
}
And the generated .classpath is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11/">
<accessrules>
<accessrule kind="accessible" pattern="sun/misc/**"/>
<accessrule kind="accessible" pattern="com/sun/net/**"/>
</accessrules>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
It looks to me that the .classpath is ok, but somehow I am still getting the same error. The option to clean the Java language server workspace does not seem to help either. Appreciate if you can shed some lights on this.