accept. Those limitations are:
<p><li>The new syntax introduced by J2SE 5.0 (including enums and generics)
-has not been supported. Annotations are supported only by the low level
+has not been supported. Annotations are supported by the low level
API of Javassist.
-See the <code>javassist.bytecode.annotation</code> package.
+See the <code>javassist.bytecode.annotation</code> package
+(and also <code>getAnnotations()</code>
+in <code>CtClass</code> and <code>CtBehavior</code>).
+Generics are also only partly supported. See <a href="./tutorial3.html#generics">the latter section</a> for more details.
<p><li>Array initializers, a comma-separated list of expressions
enclosed by braces <code>{</code> and <code>}</code>, are not
<hr>
Java(TM) is a trademark of Sun Microsystems, Inc.<br>
-Copyright (C) 2000-2010 by Shigeru Chiba, All rights reserved.
+Copyright (C) 2000-2014 by Shigeru Chiba, All rights reserved.
</body>
</html>
</pre></ul>
<p>So when you write a bytecode transformer, you can just drop
-off all type parameters. For example, if you have a class:
+off all type parameters. Because the compiler embedded in Javassist
+does not support generics,
+you must insert an explicit type cast at the
+caller site if the source code is compiled by Javassist, for example,
+through <code>CtMethod.make()</code>. No type cast
+is necessary if the source code is compiled by a normal Java compiler
+such as <code>javac</code>.
+
+<p>For example, if you have a class:
<ul><pre>
public class Wrapper<T> {
}
</pre></ul>
-<p>Then the interface you really have to add is <code>Getter</code>
+<p>then the interface you really have to add is <code>Getter</code>
(the type parameters <code><T></code> drops off)
and the method you also have to add to the <code>Wrapper</code>
class is this simple one:
</pre></ul>
<p>Note that no type parameters are necessary.
+Since <code>get</code> returns an <code>Object</code>, an explicit type cast
+is needed at the caller site if the source code is compiled by Javassist.
+For example, if the type parameter <code>T</code>
+is <code>String</code>, then <code>(String)</code> must be inserted as follows:
+
+<ul><pre>
+Wrapper w = ...
+String s = (String)w.get();
+</pre></ul>
+
+<p>The type cast is not needed if the source code is compiled by a normal Java
+compiler because it will automatically insert a type cast.
-<p>However, if you need to make type parameters accessible through reflection
+<p>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>The parameter type <code>int...</code> is changed into <code>int[]</code>
and <code>Modifier.VARARGS</code> is added to the method modifiers.
-<p>To call this method, you must write:
+<p>To call this method in the source code compiled by the compiler embedded in Javassist,
+you must write:
<ul><pre>
length(new int[] { 1, 2, 3 });
<hr>
Java(TM) is a trademark of Sun Microsystems, Inc.<br>
-Copyright (C) 2000-2012 by Shigeru Chiba, All rights reserved.
+Copyright (C) 2000-2014 by Shigeru Chiba, All rights reserved.
</body>
</html>