aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist/ClassPool.java
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-07-26 08:55:35 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-07-26 08:55:35 +0000
commit7c1450fd7d23d45faf7036f9467c820a91d99202 (patch)
treeb1fa2d6a6f4c94480f7c9d9fdd7fd2819f6b1954 /src/main/javassist/ClassPool.java
parentaa92b8250ecf9bb0698a0844123b67a5f2ac5279 (diff)
downloadjavassist-7c1450fd7d23d45faf7036f9467c820a91d99202.tar.gz
javassist-7c1450fd7d23d45faf7036f9467c820a91d99202.zip
Changed the implementation of CtClass#toClass() and fixed [Bugs item #993105] Reflection#makeReflective could reject some reflections
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@116 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/ClassPool.java')
-rw-r--r--src/main/javassist/ClassPool.java81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java
index ce64c847..6ddcf31d 100644
--- a/src/main/javassist/ClassPool.java
+++ b/src/main/javassist/ClassPool.java
@@ -219,87 +219,6 @@ public class ClassPool {
return (Object[])cflow.get(name);
}
- /**
- * A simple class loader used by <code>toClass()</code>
- * in <code>CtClass</code>.
- * This class loader is provided for convenience. If you need more
- * complex functionality, you should write your own class loader.
- *
- * @see CtClass#forName(String)
- * @see CtClass#toClass()
- * @see ClassPool#toClass(CtClass)
- * @see ClassPool#forName(String)
- */
- public static class SimpleLoader extends ClassLoader {
- /**
- * Loads a class.
- *
- * @param name the fully qualified class name.
- * @param classfile the class file.
- * @throws ClassFormatError if the class file is wrong.
- */
- public Class loadClass(String name, byte[] classfile)
- throws ClassFormatError
- {
- Class c = defineClass(name, classfile, 0, classfile.length);
- resolveClass(c);
- return c;
- }
- };
-
- private static SimpleLoader classLoader = null;
-
- /**
- * Returns a <code>java.lang.Class</code> object that has been loaded
- * by <code>toClass()</code> in <code>CtClass</code>
- * or <code>ClassPool</code>. Such an object cannot be
- * obtained by <code>java.lang.Class.forName()</code> because it has
- * been loaded by an internal class loader of Javassist.
- *
- * @param name the fully-qualified class name.
- * @see #toClass(CtClass)
- */
- public Class forName(String name) throws ClassNotFoundException {
- if (classLoader == null)
- classLoader = new SimpleLoader();
-
- return classLoader.loadClass(name);
- }
-
- /**
- * Loads the class represented by a <code>CtClass</code> object.
- * <code>toClass()</code> in <code>CtClass</code> calls this method
- * to load a class.
- *
- * <p>This method can be overridden to change the class loader.
- * In the default implementation,
- * the class loader is a <code>SimpleLoader</code>.
- * If this method is overridden, <code>forName()</code> must be also
- * overridden for extending the behavior.
- *
- * @param cc the loaded <code>CtClass</code>.
- * @return the <code>java.lang.Class</code> object representing
- * the loaded class.
- * @see #forName(String)
- */
- public Class toClass(CtClass cc)
- throws NotFoundException, CannotCompileException, IOException
- {
- if (cc.getClassPool() != this)
- throw new CannotCompileException(
- "not contained in this class pool: " + cc.getName());
-
- try {
- if (classLoader == null)
- classLoader = new SimpleLoader();
-
- return classLoader.loadClass(cc.getName(), cc.toBytecode());
- }
- catch (ClassFormatError e) {
- throw new CannotCompileException(e, cc.getName());
- }
- }
-
/**
* Reads a class file and constructs a <code>CtClass</code>
* object with a new name.