]> source.dussan.org Git - javassist.git/commitdiff
Move handling of primitive class value from MemberValue to ClassMemberValue
authorkkhan <kkhan@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Fri, 14 Jul 2006 10:04:35 +0000 (10:04 +0000)
committerkkhan <kkhan@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Fri, 14 Jul 2006 10:04:35 +0000 (10:04 +0000)
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@292 30ef5769-5b8d-40dd-aea6-55b5d6557bb3

src/main/javassist/bytecode/annotation/ClassMemberValue.java
src/main/javassist/bytecode/annotation/MemberValue.java

index cf2f510b4cbc4ba0850584a745a43464f7553afd..af2a6c36194a336abb66dba8e26fad4fafef0004 100644 (file)
@@ -63,7 +63,44 @@ public class ClassMemberValue extends MemberValue {
     Object getValue(ClassLoader cl, ClassPool cp, Method m)
         throws ClassNotFoundException
     {
-        return loadClass(cl, getValue());
+        final String classname = getValue();
+        if (classname.equals("void"))
+        {
+            return void.class;
+        }
+        if (classname.equals("int"))
+        {
+            return int.class;
+        }
+        if (classname.equals("byte"))
+        {
+            return byte.class;
+        }
+        if (classname.equals("long"))
+        {
+            return long.class;
+        }
+        if (classname.equals("double"))
+        {
+            return double.class;
+        }
+        if (classname.equals("float"))
+        {
+            return float.class;
+        }
+        if (classname.equals("char"))
+        {
+            return char.class;
+        }
+        if (classname.equals("short"))
+        {
+            return short.class;
+        }
+        if (classname.equals("boolean"))
+        {
+           return boolean.class;
+        }
+        return loadClass(cl, classname);
     }
 
     Class getType(ClassLoader cl) throws ClassNotFoundException {
index cd2f3cc83dd6bafd8aee677469efb497242f980e..f2e709166bac35102d54c402be8b83359bfdfd3e 100644 (file)
@@ -48,42 +48,6 @@ public abstract class MemberValue {
     static Class loadClass(ClassLoader cl, String classname)
         throws ClassNotFoundException
     {
-       if (classname.equals("void"))
-       {
-          return void.class;
-       }
-       if (classname.equals("int"))
-       {
-          return int.class;
-       }
-       if (classname.equals("byte"))
-       {
-          return byte.class;
-       }
-       if (classname.equals("long"))
-       {
-          return long.class;
-       }
-       if (classname.equals("double"))
-       {
-          return double.class;
-       }
-       if (classname.equals("float"))
-       {
-          return float.class;
-       }
-       if (classname.equals("char"))
-       {
-          return char.class;
-       }
-       if (classname.equals("short"))
-       {
-          return short.class;
-       }
-       if (classname.equals("boolean"))
-       {
-          return boolean.class;
-       }
        return Class.forName(classname, true, cl);
     }