From 07ede64867da6e2c443556162a35c9f098e769e9 Mon Sep 17 00:00:00 2001 From: kkhan Date: Thu, 8 Mar 2007 13:05:47 +0000 Subject: [PATCH] When pruning preserve the SignatureAttribute git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@356 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/bytecode/ClassFile.java | 7 +++++++ src/main/javassist/bytecode/FieldInfo.java | 7 +++++++ src/main/javassist/bytecode/MethodInfo.java | 7 +++++++ 3 files changed, 21 insertions(+) diff --git a/src/main/javassist/bytecode/ClassFile.java b/src/main/javassist/bytecode/ClassFile.java index 013b533e..82221d45 100644 --- a/src/main/javassist/bytecode/ClassFile.java +++ b/src/main/javassist/bytecode/ClassFile.java @@ -168,6 +168,13 @@ public final class ClassFile { newAttributes.add(visibleAnnotations); } + AttributeInfo signature + = getAttribute(SignatureAttribute.tag); + if (signature != null) { + signature = signature.copy(cp, null); + newAttributes.add(signature); + } + ArrayList list = methods; int n = list.size(); for (int i = 0; i < n; ++i) { diff --git a/src/main/javassist/bytecode/FieldInfo.java b/src/main/javassist/bytecode/FieldInfo.java index f0a13faf..5d96df84 100644 --- a/src/main/javassist/bytecode/FieldInfo.java +++ b/src/main/javassist/bytecode/FieldInfo.java @@ -100,6 +100,13 @@ public final class FieldInfo { newAttributes.add(visibleAnnotations); } + AttributeInfo signature + = getAttribute(SignatureAttribute.tag); + if (signature != null) { + signature = signature.copy(cp, null); + newAttributes.add(signature); + } + int index = getConstantValue(); if (index != 0) { index = constPool.copy(index, cp, null); diff --git a/src/main/javassist/bytecode/MethodInfo.java b/src/main/javassist/bytecode/MethodInfo.java index 87b8e76a..8d0cce10 100644 --- a/src/main/javassist/bytecode/MethodInfo.java +++ b/src/main/javassist/bytecode/MethodInfo.java @@ -164,6 +164,13 @@ public final class MethodInfo { if (ea != null) newAttributes.add(ea); + AttributeInfo signature + = getAttribute(SignatureAttribute.tag); + if (signature != null) { + signature = signature.copy(cp, null); + newAttributes.add(signature); + } + attribute = newAttributes; name = cp.addUtf8Info(getName()); descriptor = cp.addUtf8Info(getDescriptor()); -- 2.39.5