1 18 package org.objectweb.speedo.generation.enhancer; 19 20 import org.objectweb.asm.ClassVisitor; 21 import org.objectweb.util.monolog.api.Logger; 22 import org.objectweb.util.monolog.api.BasicLevel; 23 import org.objectweb.speedo.metadata.SpeedoClass; 24 import org.objectweb.speedo.generation.lib.NamingRules; 25 26 38 public class InheritanceModifier extends LoggedClassAdapter { 39 40 44 private String newSuperClassName; 45 46 public InheritanceModifier(ClassVisitor classVisitor, 47 Logger logger, 48 SpeedoClass sc, 49 boolean beforeCompilation) { 50 super(classVisitor, logger); 51 if (sc.superClassName != null 52 && sc.superClassName.length() > 0) { 53 newSuperClassName = (beforeCompilation 54 ? NamingRules.proxyName(sc.superClassName) 55 : sc.superClassName); 56 newSuperClassName = newSuperClassName.replace('.','/'); 57 } else { 58 newSuperClassName = null; 59 } 60 if (debug) { 61 logger.log(BasicLevel.DEBUG, "Inheritance modifier of the class " 62 + sc.getFQName() + ": newSuperClassName=" + newSuperClassName); 63 } 64 } 65 66 public void visit(final int version, final int access, 67 final String name, 68 final String superName, 69 final String [] interfaces, 70 final String sourceFile) { 71 String inherit = (newSuperClassName == null 72 ? superName : newSuperClassName); 73 if (debug) { 74 logger.log(BasicLevel.DEBUG, "InheritanceModifier.visit(" 75 + name + ", " + superName + "): " + inherit); 76 } 77 super.visit(version, access, name, inherit, interfaces, sourceFile); 78 } 79 } 80 | Popular Tags |