From 5a846bbe359bb0ff658d79e31c319276e47da4e9 Mon Sep 17 00:00:00 2001 From: chiba Date: Tue, 8 Jul 2003 02:20:59 +0000 Subject: minor bugs have been fixed. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@27 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- tutorial/tutorial.html | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'tutorial/tutorial.html') 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. +

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. +


4.1 Using javassist.Loader

@@ -462,6 +469,33 @@ a runtime exception because of type mismatch; the type of L1 whereas the type of this is the class Point loaded by L2. +

javassist.Loader searches for classes in a different +order from java.lang.ClassLoader. +ClassLoader 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, +javassist.Loader attempts +to load the classes before delegating to the parent class loader. +It delegates only if: + +

+ +

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. If your +program fails to load a modified class, you should make sure whether +all the classes using that class have been loaded by +javassist.Loader. +


4.2 Writing a class loader

-- cgit v1.2.3