diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2003-07-08 02:20:59 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2003-07-08 02:20:59 +0000 |
commit | 5a846bbe359bb0ff658d79e31c319276e47da4e9 (patch) | |
tree | a22efbdb289fcea2f9b9a645c137550149a93b91 /tutorial/tutorial.html | |
parent | 5372926c9102cd4fbc16bb8297bd80c50f3d8ab6 (diff) | |
download | javassist-5a846bbe359bb0ff658d79e31c319276e47da4e9.tar.gz javassist-5a846bbe359bb0ff658d79e31c319276e47da4e9.zip |
minor bugs have been fixed.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@27 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'tutorial/tutorial.html')
-rw-r--r-- | tutorial/tutorial.html | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/tutorial/tutorial.html b/tutorial/tutorial.html index 29fcaec4..36104e30 100644 --- a/tutorial/tutorial.html +++ b/tutorial/tutorial.html @@ -317,6 +317,13 @@ modified at load time. The users of Javassist can define their own version of class loader but they can also use a class loader provided by Javassist. +<p>Using a class loader is not easy. Especially if you are a beginner, +you should separate your program into an application program and an +instrumentation program and each of the two programs should be loaded +by a single class loader. You should +avoid loading part of the application program with the default class loader +and the rest of the program with a user-defined class loader. + <p><br> <h3>4.1 Using <code>javassist.Loader</code></h3> @@ -462,6 +469,33 @@ a runtime exception because of type mismatch; the type of <code>L1</code> whereas the type of <code>this</code> is the class <code>Point</code> loaded by <code>L2</code>. +<p><code>javassist.Loader</code> searches for classes in a different +order from <code>java.lang.ClassLoader</code>. +<code>ClassLoader</code> first delegates the loading operations to +the parent class loader and then attempts to load the classes +only if the parent class loader cannot find them. +On the other hand, +<code>javassist.Loader</code> attempts +to load the classes before delegating to the parent class loader. +It delegates only if: + +<ul><li>the classes are not found by using the <code>ClassPool</code> +object, or + +<p><li>the classes have been specified by using +<code>delegateLoadingOf()</code> +to be loaded by the parent class loader. +</ul> + +<p>This search order allows loading modified classes by Javassist into +the JVM. However, it delegates to the parent class loader if it fails +to find modified classes for some reason. Once a class is loaded by +the parent class loader, the other classes used by that class will be +also loaded without modification by the parent class loader. <em>If your +program fails to load a modified class,</em> you should make sure whether +all the classes using that class have been loaded by +<code>javassist.Loader</code>. + <p><br> <h3>4.2 Writing a class loader</h3> |