diff options
Diffstat (limited to 'tutorial/tutorial3.html')
-rw-r--r-- | tutorial/tutorial3.html | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/tutorial/tutorial3.html b/tutorial/tutorial3.html index e07372bd..7c505e0b 100644 --- a/tutorial/tutorial3.html +++ b/tutorial/tutorial3.html @@ -28,7 +28,9 @@ <p><a href="#j2me">8. J2ME</a> -<p><a href="#debug">9. Debug</a> +<p><a href="#boxing">9. Boxing/Unboxing + +<p><a href="#debug">10. Debug</a> <p><br> @@ -296,6 +298,11 @@ public Object get() { return value; } <p>Note that no type parameters are necessary. +<p>However, if you need to make type parameters accessible through reflection +during runtime, you have to add generic signatures to the class file. +For more details, see the API documentation (javadoc) of the +<code>setGenericSignature</code> method in the <code>CtClass</code>. + <p><br> <h2><a name="varargs">7. Varargs</a></h2> @@ -359,7 +366,26 @@ objects, call the <code>getDeclaredMethods</code> method on a <code>CtClass</cod <p><br> -<h2><a name="debug">9. Debug</h2> +<h2><a name="boxing">9. Boxing/Unboxing</h2> + +<p>Boxing and unboxing in Java are syntactic sugar. There is no bytecode for +boxing or unboxing. So the compiler of Javassist does not support them. +For example, the following statement is valid in Java: + +<ul><pre> +Integer i = 3; +</pre></ul> + +<p>since boxing is implicitly performed. For Javassist, however, you must explicitly +convert a value type from <code>int</code> to <code>Integer</code>: + +<ul><pre> +Integer i = new Integer(3); +</pre></ul> + +<p><br> + +<h2><a name="debug">10. Debug</h2> <p>Set <code>CtClass.debugDump</code> to a directory name. Then all class files modified and generated by Javassist are saved in that |