Question: I was encrypting some text, for which I used `BASE64Encoder`

```
String encryptedValue = new BASE64Encoder().encode(encVal);

```

But I am getting a warning

```
The constructor 'BASE64Encoder()' is not API (restriction on required library 'C:\Program Files (x86)\Java\jdk1.8.0_45\jre\lib\rt.jar')
The method 'CharacterEncoder.encode(byte[])' is not API (restriction on required library 'C:\Program Files (x86)\Java\jdk1.8.0_45\jre\lib\rt.jar')
Access restriction: The type 'BASE64Encoder' is not API (restriction on required library 'C:\Program Files (x86)\Java\jdk1.8.0_45\jre\lib\rt.jar')

```

I can suppress this warning by `@SuppressWarnings("restriction")`. But I want to know why I am getting this warning. Will it create problems later?

Answer: 
You should really avoid to call `sun.*` classes :

> 
> A Java program that directly calls into sun.\* packages is not
>  guaranteed to work on all Java-compatible platforms. In fact, such a
>  program is not guaranteed to work even in future versions on the same
>  platform.
> 
> 
> 

[Why Developers Should Not Write Programs 
That Call 'sun' Packages](http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html)

Other libraries, like Apache Commons Codec will do what you need :

[Commons Codec Base64](https://commons.apache.org/proper/commons-codec/apidocs/org/apache/commons/codec/binary/Base64.html)
BASE64Encoder reside in sun.misc package. As you are using 1.8 version which even Oracle discourages to use. Read it here <http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html>.

Abstract from that link:
*`From one release to another, these classes may be removed, or they may be moved from one package to another, and it's fairly likely that their interface (method names and signatures) will change`*