Thursday, August 2, 2012

sun.* Packages

Came accross this the other day when a coworker used sun.misc.Base64Decoder, something didn't feel right about the package name, but I had no justification on why he shouldn't use it. After a bit of searching I found the following link:
Sun Packages FAQ  

Quote:
The java.*, javax.* and org.* packages documented in the Java 2 Platform Standard Edition API Specification make up the official, supported, public interface.
 If a Java program directly calls only API in these packages, it will operate on all Java-compatible platforms, regardless of the underlying OS platform.


 The sun.* packages are not part of the supported, public interface. 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.

Makes obvious sense now, but it was actually something I was not aware of.

6 comments:

  1. Checkstyle verwenden! Warnung bei sun.* Packages ist Standard für den IllegalImport Check (http://checkstyle.sourceforge.net/config_imports.html). Man kann Checkstyle Konfigurationen in die IDE laden oder z.B. in Maven Builds als Plugin integrieren. Noch komfortabler wird es mit Sonar (http://www.sonarsource.org/). Auch gleich mit Findbug kombinieren, damit andere typische Programmierfehler erkannt werden.

    ReplyDelete
  2. Ok, my german isnt great, but I do get Checkstyle & Sonar, config, IDE, warning, illegalimport :)
    Yes we do use checkstyle (probably the reason I had not run into the issue before), it just happened that this bit of code wasn't in our standard maven / code setup yet.

    ReplyDelete
  3. I have seen Java with many packages which helpful in developing application.but i don't know more about sun.*.I just came to know from your site.

    ReplyDelete
  4. Many interesting information I can find what I am very happy.

    ReplyDelete
  5. before you can choose whether or not you want to change your existing car speakers and if you want to attach them to amplifiers to get the best sound quality, the easiest thing to do is to read a little more about the car door speakers themselves.

    ReplyDelete

Popular Posts

Followers