[jboss-cvs] javassist/src/main/javassist ...
Shigeru Chiba
chiba at is.titech.ac.jp
Thu May 24 06:54:41 EDT 2007
User: chiba
Date: 07/05/24 06:54:41
Modified: src/main/javassist ClassPool.java
Log:
a minor API extension.
Revision Changes Path
1.61 +23 -1 javassist/src/main/javassist/ClassPool.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: ClassPool.java
===================================================================
RCS file: /cvsroot/jboss/javassist/src/main/javassist/ClassPool.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -b -r1.60 -r1.61
--- ClassPool.java 24 May 2007 07:46:57 -0000 1.60
+++ ClassPool.java 24 May 2007 10:54:41 -0000 1.61
@@ -586,11 +586,33 @@
public CtClass makeClass(InputStream classfile)
throws IOException, RuntimeException
{
+ return makeClass(classfile, true);
+ }
+
+ /**
+ * Creates a new class (or interface) from the given class file.
+ * If there already exists a class with the same name, the new class
+ * overwrites that previous class.
+ *
+ * <p>This method is used for creating a <code>CtClass</code> object
+ * directly from a class file. The qualified class name is obtained
+ * from the class file; you do not have to explicitly give the name.
+ *
+ * @param classfile class file.
+ * @param ifNotFrozen throws a RuntimeException if this parameter is true
+ * and there is a frozen class with the same name.
+ * @see javassist.ByteArrayClassPath
+ */
+ public CtClass makeClass(InputStream classfile, boolean ifNotFrozen)
+ throws IOException, RuntimeException
+ {
classfile = new BufferedInputStream(classfile);
CtClass clazz = new CtClassType(classfile, this);
clazz.checkModify();
String classname = clazz.getName();
+ if (ifNotFrozen)
checkNotFrozen(classname);
+
cacheCtClass(classname, clazz, true);
return clazz;
}
More information about the jboss-cvs-commits
mailing list