Most of our projects are built with Maven, and some of them use classes in the com.sun package. That's a bad practice, but there's not much I can do about it.
For a while this didn't seem to be a big problem. Then, at some point, builds started failing for me with errors such as the following:
java.lang.Error: Unresolved compilation problems:
Access restriction: The type TextSerializer is not accessible due to res
triction on required library C:\Program Files\Java\jre1.5.0_15\lib\rt.jar
That's fair enough, but I couldn't for the life of me figure out how to turn off that check. The builds were failing both from the command line and from within Eclipse, so I assumed it must be some Maven setting.
Eventually I figured out that the problem was somehow with Eclipse. I went to Preferences > Java > Compiler > Errors/Warnings > Deprecated and restricted API and changed 'Forbidden Reference' to 'Warning'. Thereafter, my builds started working. This is completely incomprehensible to me, because I was getting the errors when building from the command line.
Can someone please explain to me how an Eclipse setting can somehow affect the behaviour of a build from the command line?!