use of javassist.bytecode.ExceptionsAttribute in project fakereplace by fakereplace.
the class MethodReplacementTransformer method copyMethodAttributes.
public static void copyMethodAttributes(MethodInfo oldMethod, MethodInfo newMethod) {
AnnotationsAttribute annotations = (AnnotationsAttribute) oldMethod.getAttribute(AnnotationsAttribute.visibleTag);
ParameterAnnotationsAttribute pannotations = (ParameterAnnotationsAttribute) oldMethod.getAttribute(ParameterAnnotationsAttribute.visibleTag);
ExceptionsAttribute exAt = (ExceptionsAttribute) oldMethod.getAttribute(ExceptionsAttribute.tag);
SignatureAttribute sigAt = (SignatureAttribute) oldMethod.getAttribute(SignatureAttribute.tag);
if (annotations != null) {
AttributeInfo newAnnotations = annotations.copy(newMethod.getConstPool(), Collections.EMPTY_MAP);
newMethod.addAttribute(newAnnotations);
}
if (pannotations != null) {
AttributeInfo newAnnotations = pannotations.copy(newMethod.getConstPool(), Collections.EMPTY_MAP);
newMethod.addAttribute(newAnnotations);
}
if (sigAt != null) {
AttributeInfo newAnnotations = sigAt.copy(newMethod.getConstPool(), Collections.EMPTY_MAP);
newMethod.addAttribute(newAnnotations);
}
if (exAt != null) {
AttributeInfo newAnnotations = exAt.copy(newMethod.getConstPool(), Collections.EMPTY_MAP);
newMethod.addAttribute(newAnnotations);
}
}
Aggregations