git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@119 30ef5769-5b8d-40dd-aea6-55b5d6557bb3tags/rel_3_17_1_ga
@@ -19,7 +19,7 @@ import javassist.*; | |||
import javassist.CtMethod.ConstParameter; | |||
/** | |||
* The class implementing the reflection mechanism. | |||
* The class implementing the behavioral reflection mechanism. | |||
* | |||
* <p>If a class is reflective, | |||
* then all the method invocations on every |
@@ -1,11 +1,13 @@ | |||
<html> | |||
<body> | |||
Runtime Reflection. | |||
Runtime Behavioral Reflection. | |||
<p>(also recently known as AOP) | |||
<p>This package enables a metaobject to trap method calls and field | |||
accesses on a regular Java object. It provides a class | |||
<code>Reflection</code>, which is a main module for implementing | |||
runtime reflection. | |||
runtime behavioral reflection. | |||
It also provides | |||
a class <code>Loader</code> and <code>Compiler</code> | |||
as utilities for dynamically or statically |
@@ -434,10 +434,10 @@ and calls <code>say()</code> on that instance. | |||
<p>Note that the program above depends on the fact that the | |||
<code>Hello</code> class is never loaded before <code>toClass()</code> | |||
is invoked. If not, the JVM would load the original | |||
<code>Hello</code> class before <code>toClass()</code> request to load | |||
the modified <code>Hello</code> class. Hence loading the modified | |||
<code>Hello</code> class would be failed. | |||
For example, if | |||
<code>Hello</code> class before <code>toClass()</code> requests to | |||
load the modified <code>Hello</code> class. Hence loading the | |||
modified <code>Hello</code> class would be failed | |||
(<code>LinkageError</code> is thrown). For example, if | |||
<code>main()</code> in <code>Test</code> is something like this: | |||
<ul><pre> | |||
@@ -455,12 +455,12 @@ throws an exception since the class loader cannot load two different | |||
versions of the <code>Hello</code> class at the same time. | |||
<p><em>If the program is running on some application server such as | |||
JBoss,</em> the context class loader used by <code>toClass()</code> | |||
might be inappropriate. In this case, you would see an unexpected | |||
<code>ClassCastException</code>. To avoid this exception, you must | |||
explicitly give an appropriate class loader to <code>toClass()</code>. | |||
For example, if <code>bean</code> is your session bean object, then the | |||
following code: | |||
JBoss and Tomcat,</em> the context class loader used by | |||
<code>toClass()</code> might be inappropriate. In this case, you | |||
would see an unexpected <code>ClassCastException</code>. To avoid | |||
this exception, you must explicitly give an appropriate class loader | |||
to <code>toClass()</code>. For example, if <code>bean</code> is your | |||
session bean object, then the following code: | |||
<ul><pre>CtClass cc = ...; | |||
Class c = cc.toClass(bean.getClass().getClassLoader()); |
@@ -18,6 +18,7 @@ | |||
<li><a href="#before">Inserting source text at the beginning/end of a method body</a> | |||
<br><li><a href="#alter">Altering a method body</a> | |||
<br><li><a href="#add">Adding a new method or field</a> | |||
<br><li><a href="#runtime">Runtime support classes</a> | |||
<br><li><a href="#limit">Limitations</a> | |||
</ul> | |||
@@ -1269,8 +1270,22 @@ does not end with a semi colon (<code>;</code>). | |||
<p><br> | |||
<a name="runtime"> | |||
<h3>5.4 Runtime support classes</h3> | |||
<p>In most cases, a class modified by Javassist does not require | |||
Javassist to run. However, some kinds of bytecode generated by the | |||
Javassist compiler need runtime support classes, which are in the | |||
<code>javassist.runtime</code> package (for details, please read | |||
the API reference of that package). Note that the | |||
<code>javassist.runtime</code> package is the only package that | |||
classes modified by Javassist may need for running. The other | |||
Javassist classes are never used at runtime of the modified classes. | |||
<p><br> | |||
<a name="limit"> | |||
<h3>5.4 Limitations</h3> | |||
<h3>5.5 Limitations</h3> | |||
<p>In the current implementation, the Java compiler included in Javassist | |||
has several limitations with respect to the language that the compiler can |