View Javadoc

1   package it.imolinfo.jbi4corba.webservice.generator.typedef;
2   
3   import it.imolinfo.jbi4corba.Logger;
4   import it.imolinfo.jbi4corba.LoggerFactory;
5   
6   import org.objectweb.asm.ClassAdapter;
7   import org.objectweb.asm.ClassVisitor;
8   import org.objectweb.asm.Opcodes;
9   
10  /**
11   * Removes the <code>final</code> class modifier to extend the class.
12   * 
13   * @author <a href="mailto:mpiraccini@imolinfo.it">Marco Piraccini</a> 
14   */
15  
16  public class RemoveFinalAdapter extends ClassAdapter {
17  	
18  	/**
19  	 * Logger.
20  	 */
21  	private static final Logger LOG = LoggerFactory
22  			.getLogger(RemoveFinalAdapter.class);
23  	
24  	public RemoveFinalAdapter(ClassVisitor cv) {
25  		super(cv);
26  	}
27  	
28  	@Override
29  	public void visit(int version, int access, String name, String signature,
30  			String superName, String[] interfaces) {
31  	    // Remove the "final". Probably the analog operation in the IdlToWsdl adapter is the useless.
32  	    if ((Opcodes.ACC_FINAL & access) == Opcodes.ACC_FINAL) {
33  	        access = access & (~Opcodes.ACC_FINAL);
34  	        LOG.debug("Removed final from class");
35  	    }
36  		super.visit(version, access, name, signature, superName, interfaces);
37  
38  	}	
39  
40  }