public void prune(){
  ConstPool cp=compact0();
  ArrayList newAttributes=new ArrayList();
  AttributeInfo invisibleAnnotations=getAttribute(AnnotationsAttribute.invisibleTag);
  if (invisibleAnnotations != null) {
    invisibleAnnotations=invisibleAnnotations.copy(cp,null);
    newAttributes.add(invisibleAnnotations);
  }
  AttributeInfo visibleAnnotations=getAttribute(AnnotationsAttribute.visibleTag);
  if (visibleAnnotations != null) {
    visibleAnnotations=visibleAnnotations.copy(cp,null);
    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) {
    MethodInfo minfo=(MethodInfo)list.get(i);
    minfo.prune(cp);
  }
  list=fields;
  n=list.size();
  for (int i=0; i < n; ++i) {
    FieldInfo finfo=(FieldInfo)list.get(i);
    finfo.prune(cp);
  }
  attributes=newAttributes;
  constPool=cp;
}

public void prune ( ) { ConstPool cp = compact0 ( ) ; ArrayList newAttributes = new ArrayList ( ) ; AttributeInfo invisibleAnnotations = getAttribute ( AnnotationsAttribute . invisibleTag ) ; if ( invisibleAnnotations != null ) { invisibleAnnotations = invisibleAnnotations . copy ( cp , null ) ; newAttributes . add ( invisibleAnnotations ) ; } AttributeInfo visibleAnnotations = getAttribute ( AnnotationsAttribute . visibleTag ) ; if ( visibleAnnotations != null ) { visibleAnnotations = visibleAnnotations . copy ( cp , null ) ; 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 ) { MethodInfo minfo = ( MethodInfo ) list . get ( i ) ; minfo . prune ( cp ) ; } list = fields ; n = list . size ( ) ; for ( int i = 0 ; i < n ; ++ i ) { FieldInfo finfo = ( FieldInfo ) list . get ( i ) ; finfo . prune ( cp ) ; } attributes = newAttributes ; constPool = cp ; }
discards all attributes , associated with both the class file and the members such as a code attribute and exceptions attribute . the unused constant pool entries are also discarded ( a new packed constant pool is constructed ) .
