diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2006-11-07 04:19:37 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2006-11-07 04:19:37 +0000 |
commit | 1a24a3971de663bd7c7e303eab5bbaafe03b327e (patch) | |
tree | 96adb06228c9df14f8783c1a44f9fb61f9af16af /src/main/javassist/bytecode/ClassFile.java | |
parent | 56af2ace49d2ea3778fa8fb12621117cd4b272f4 (diff) | |
download | javassist-1a24a3971de663bd7c7e303eab5bbaafe03b327e.tar.gz javassist-1a24a3971de663bd7c7e303eab5bbaafe03b327e.zip |
Fixed a bug of duplicating writeReplace() to a proxy class.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@330 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/bytecode/ClassFile.java')
-rw-r--r-- | src/main/javassist/bytecode/ClassFile.java | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/main/javassist/bytecode/ClassFile.java b/src/main/javassist/bytecode/ClassFile.java index 5dbc19a0..013b533e 100644 --- a/src/main/javassist/bytecode/ClassFile.java +++ b/src/main/javassist/bytecode/ClassFile.java @@ -465,8 +465,10 @@ public final class ClassFile { /** * Appends a field to the class. + * + * @throws DuplicateMemberException when the field is already included. */ - public void addField(FieldInfo finfo) throws CannotCompileException { + public void addField(FieldInfo finfo) throws DuplicateMemberException { testExistingField(finfo.getName(), finfo.getDescriptor()); fields.add(finfo); } @@ -476,12 +478,12 @@ public final class ClassFile { } private void testExistingField(String name, String descriptor) - throws CannotCompileException { + throws DuplicateMemberException { ListIterator it = fields.listIterator(0); while (it.hasNext()) { FieldInfo minfo = (FieldInfo)it.next(); if (minfo.getName().equals(name)) - throw new CannotCompileException("duplicate field: " + name); + throw new DuplicateMemberException("duplicate field: " + name); } } @@ -523,8 +525,10 @@ public final class ClassFile { /** * Appends a method to the class. + * + * @throws DuplicateMemberException when the method is already included. */ - public void addMethod(MethodInfo minfo) throws CannotCompileException { + public void addMethod(MethodInfo minfo) throws DuplicateMemberException { testExistingMethod(minfo); methods.add(minfo); } @@ -534,7 +538,7 @@ public final class ClassFile { } private void testExistingMethod(MethodInfo newMinfo) - throws CannotCompileException + throws DuplicateMemberException { String name = newMinfo.getName(); String descriptor = newMinfo.getDescriptor(); @@ -545,7 +549,7 @@ public final class ClassFile { && notBridgeMethod(minfo) && notBridgeMethod(newMinfo) && Descriptor.eqParamTypes(minfo.getDescriptor(), descriptor)) - throw new CannotCompileException("duplicate method: " + name + throw new DuplicateMemberException("duplicate method: " + name + " in " + this.getName()); } } |