In the process of hacking on the java agent code the other day, I ran
into a few places where we are directly referring to sun.* or
com.sun.* classes. I removed the user of
com.sun.naming.internal.ResourceManager in the IvmContext but we
still have a few places where we are using sun classes. Should it be
one of our goals to not have hard references to sun classes?
Here are the places I know that we are using sun classes:
JarUtils uses suntools.jar.Main to add an entry to an existing jar.
This could be replaced by creating a new temp jar with
JarOutputStream copying all the data from the existing jar and adding
the one new entry. Then you swap the two files.
BasicURLClassPath, SystemClassPath and TomcatClassPath directly
reference sun.misc.URLClassPath. This reference is obtained using
reflection and set accessible, so with a bit more reflection we
should be able to remove the reference.
That's it. So should we remove these?
-dain