It is an access restriction error.
Method 1:
Global property Project>preferences>java>Compiler>Errors/Warnings> set the [Deprecated and restricted API>Forbidden reference Error] on the right to [Warning].
Method 2 (Ultimate method:)
Project properties preferences>java build path>Delete and re-import [JRE System Library in libraries] on the right.