@@ -2,11 +2,13 @@ package proguard.util
22
33import  proguard.analysis.cpa.jvm.cfa.JvmCfa 
44import  proguard.classfile.ClassPool 
5+ import  proguard.classfile.Clazz 
56import  proguard.classfile.Method 
67import  proguard.classfile.MethodSignature 
78import  proguard.classfile.ProgramClass 
89import  proguard.classfile.ProgramMethod 
910import  proguard.classfile.attribute.Attribute 
11+ import  proguard.classfile.attribute.visitor.AllAttributeVisitor 
1012import  proguard.classfile.attribute.visitor.AttributeNameFilter 
1113import  proguard.classfile.instruction.visitor.AllInstructionVisitor 
1214import  proguard.classfile.visitor.ClassPrinter 
@@ -22,52 +24,52 @@ import java.io.StringWriter
2224object  DebugUtil {
2325
2426    /* *
25-      * Get the bytecode of a particular [ProgramClass ]. 
27+      * Get the bytecode of a particular [Clazz ]. 
2628     */  
2729    @JvmStatic
28-     fun  asString (clazz :  ProgramClass ): String  {
30+     fun  asString (clazz :  Clazz ): String  {
2931        val  sw =  StringWriter ()
3032        val  pw =  PrintWriter (sw)
3133        clazz.accept(ClassPrinter (pw))
3234        return  sw.toString()
3335    }
3436
3537    /* *
36-      * Get the bytecode of a particular [ProgramMethod ]. 
38+      * Get the bytecode of a particular [Method ]. 
3739     */  
3840    @JvmStatic
3941    @JvmOverloads
40-     fun  asString (clazz :  ProgramClass , method :  ProgramMethod , verbose :  Boolean  = false): String  {
42+     fun  asString (clazz :  Clazz , method :  Method , verbose :  Boolean  = false): String  {
4143        val  sw =  StringWriter ()
4244        val  pw =  PrintWriter (sw)
4345        if  (verbose) {
4446            method.accept(clazz, ClassPrinter (pw))
4547        } else  {
46-             method.attributesAccept (clazz, AttributeNameFilter (Attribute .CODE , AllInstructionVisitor (ClassPrinter (pw))))
48+             method.accept (clazz, AllAttributeVisitor ( AttributeNameFilter (Attribute .CODE , AllInstructionVisitor (ClassPrinter (pw) ))))
4749        }
4850        return  sw.toString()
4951    }
5052
5153    /* *
52-      * Get the bytecode of a particular [ProgramMethod ] from your [ClassPool]. 
54+      * Get the bytecode of a particular [Method ] from your [ClassPool]. 
5355     */  
5456    @JvmStatic
5557    @JvmOverloads
5658    fun  asString (classPool :  ClassPool , signature :  MethodSignature , verbose :  Boolean  = false): String  {
5759        val  clazz =  classPool.getClass(signature.className)
58-         check(clazz is  ProgramClass ) { " Program class  " +  clazz.name +  "  not found in class pool" 
60+         check(clazz is  Clazz ) { " Class  " +  clazz.name +  "  not found in class pool" 
5961        val  method =  clazz.findMethod(signature.method, signature.descriptor.toString())
60-         check(method is  ProgramMethod ) { " Program method  " +  signature +  "  not found in class " +  clazz.getName()  }
62+         check(method is  Method ) { " Method  " +  signature +  "  not found in class " +  clazz.name  }
6163        return  asString(clazz, method, verbose)
6264    }
6365
6466    /* *
65-      * Get the bytecode of all methods in a [ProgramClass ] from your [ClassPool]. 
67+      * Get the bytecode of all methods in a [Class ] from your [ClassPool]. 
6668     */  
6769    @JvmStatic
6870    fun  asString (classPool :  ClassPool , className :  String ): String  {
6971        val  clazz =  classPool.getClass(className)
70-         check(clazz is  ProgramClass ) { " Program class  $className  not found in class pool" 
72+         check(clazz is  Clazz ) { " Class  $className  not found in class pool" 
7173        return  asString(clazz)
7274    }
7375
0 commit comments