From 0dfd78b0e5a50a9f3531d75a8543d8bdf54df24a Mon Sep 17 00:00:00 2001 From: chiba Date: Thu, 8 Jul 2010 18:17:03 +0000 Subject: [PATCH] fixed JIRA JASSIST-122 git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@553 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/Modifier.java | 1 + tutorial/tutorial3.html | 42 ++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/src/main/javassist/Modifier.java b/src/main/javassist/Modifier.java index 567f1fa5..c1b30d67 100644 --- a/src/main/javassist/Modifier.java +++ b/src/main/javassist/Modifier.java @@ -35,6 +35,7 @@ public class Modifier { public static final int FINAL = AccessFlag.FINAL; public static final int SYNCHRONIZED = AccessFlag.SYNCHRONIZED; public static final int VOLATILE = AccessFlag.VOLATILE; + public static final int VARARGS = AccessFlag.VARARGS; public static final int TRANSIENT = AccessFlag.TRANSIENT; public static final int NATIVE = AccessFlag.NATIVE; public static final int INTERFACE = AccessFlag.INTERFACE; diff --git a/tutorial/tutorial3.html b/tutorial/tutorial3.html index 17e21410..9b281a13 100644 --- a/tutorial/tutorial3.html +++ b/tutorial/tutorial3.html @@ -24,7 +24,9 @@

6. Generics -

7. J2ME +

7. Varargs + +

8. J2ME


@@ -294,7 +296,43 @@ public Object get() { return value; }


-

7. J2ME

+

7. Varargs

+ +

Currently, Javassist does not directly support varargs. So to make a method with varargs, +you must explicitly set a method modifier. But this is easy. +Suppose that now you want to make the following method: + +

+ +

The following code using Javassist will make the method shown above: + +

+ +

The parameter type int... is changed into int[] +and Modifier.VARARGS is added to the method modifiers. + +

To call this method, you must write: + +

+ +

instead of this method call using the varargs mechanism: + +

+ +


+ +

8. J2ME

If you modify a class file for the J2ME execution environment, you must perform preverification. Preverifying is basically -- 2.39.5