From 2d45afd62bf1453e0e12236d7a18113d07be608a Mon Sep 17 00:00:00 2001 From: chiba Date: Fri, 11 Aug 2006 04:22:50 +0000 Subject: [PATCH] changed new CtField(CtField,..) to copy annotations. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@307 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- Readme.html | 6 ++++++ build.xml | 2 +- src/main/javassist/CtField.java | 9 +++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Readme.html b/Readme.html index c791af92..977e86e2 100644 --- a/Readme.html +++ b/Readme.html @@ -286,9 +286,15 @@ see javassist.Dump.
  • CtClass#toClass() and ClassPool#toClass() were modified to accept a ProtectionDomain (JASSIST-23). + ClassPool#toClass(CtClass, ClassLoader) is now a final method. All + subclasses of ClassPool must override toClass(CtClass, ClassLoader, + ProtectionDomain). +
  • CtClass#getAvailableAnnotations() etc. have been implemented. +
  • A bug related to a way of dealing with a bridge method was fixed (HIBERNATE-37). +
  • javassist.scopedpool package was added. diff --git a/build.xml b/build.xml index 60f051cb..00973528 100644 --- a/build.xml +++ b/build.xml @@ -6,7 +6,7 @@ - + diff --git a/src/main/javassist/CtField.java b/src/main/javassist/CtField.java index 30ea34e8..c8d62f00 100644 --- a/src/main/javassist/CtField.java +++ b/src/main/javassist/CtField.java @@ -82,6 +82,15 @@ public class CtField extends CtMember { { this(src.fieldInfo.getDescriptor(), src.fieldInfo.getName(), declaring); + java.util.ListIterator iterator + = src.fieldInfo.getAttributes().listIterator(); + FieldInfo fi = fieldInfo; + fi.setAccessFlags(src.fieldInfo.getAccessFlags()); + ConstPool cp = fi.getConstPool(); + while (iterator.hasNext()) { + AttributeInfo ainfo = (AttributeInfo)iterator.next(); + fi.addAttribute(ainfo.copy(cp, null)); + } } private CtField(String typeDesc, String name, CtClass clazz) -- 2.39.5