This error is weird and i cannot make much sense of it. I've installed EclipseRCP 3.5.1, Java SE 1.6 update 16 and switched to SWT 3.5. I've created a new project, set up the dependencies and tried to compile. When trying to import, use the following:
import com.sun.org.apache.xml.internal.serialize.OutputFormat;
import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
i get the error :
Access restriction: The type XMLSerializer is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar.
I've already google it, read some responses here..and the problem is still there. The funny thing is that if i use the previous EclipseRCP (Version: 3.4.2), this problem never occurs. The 3.4.2 version uses the same JRE version, and i've just tested the SWT version. Works fine. I guess the problem relies in some plugin of the new IDE. Any ideas?
P.S. I have found this article. But i don't like or want to change the code if i don't have to. What is the source of the problem first, and the solution will follow..
The default configuration of the Eclipse compiler is too restrictive. You can loosen it up by opening the preferences for Java -> Compiler -> Errors/Warnings and under "Deprecated and restricted API" change the setting of "Forbidden reference (access rules)" from error to warning or ignore.
A question however is if you really want to use the classes in the com.sun.-package, since you are not guaranteed that these will be available in a VM from a different vendor or a newer VM from Sun.