1 27 package org.objectweb.speedo.generation.enhancer; 28 29 import org.objectweb.asm.ClassVisitor; 30 import org.objectweb.util.monolog.api.BasicLevel; 31 import org.objectweb.util.monolog.api.Logger; 32 33 import java.util.List ; 34 35 public class ClassInterfaceAdder extends LoggedClassAdapter { 36 37 private List itfs; 38 39 public ClassInterfaceAdder(ClassVisitor classVisitor, 40 List itfs, 41 Logger logger) { 42 super(classVisitor, logger); 43 this.itfs = itfs; 44 } 45 46 public void visit(final int version, final int access, 47 final String name, 48 final String superName, 49 final String [] interfaces, 50 final String sourceFile) { 51 if (interfaces != null) { 53 for (int i = 0; i < interfaces.length; ++i) { 54 if (!itfs.contains(interfaces[i])) { 55 if (debug) { 56 logger.log(BasicLevel.DEBUG, 57 "Add the interface '" + interfaces[i] + "'"); 58 } 59 itfs.add(interfaces[i]); 60 } 61 } 62 } 63 String [] newInterfaces = (String []) itfs.toArray(new String [itfs.size()]); 64 cv.visit(version, access, name, superName, newInterfaces, sourceFile); 65 } 66 } 67 | Popular Tags |