@Override protected void generateNewFcInstanceMethod( BlockSourceCodeVisitor mv ) { mv.visitVar("Object","content","newFcContent()"); mv.visitIns("return","newFcInstance(content)"); }
@Override protected void generateNewFcInstanceMethod( BlockSourceCodeVisitor mv ) { mv.visitVar("Object","content","newFcContent()"); mv.visitIns("return","newFcInstance(content)"); }
@Override protected void generateNewFcContentMethod( BlockSourceCodeVisitor mv ) { String ctrlDesc = membraneDesc.getDescriptor(); String contentClassName = JuliacHelper.getContentClassName(ctrlDesc,contentDesc); if( contentClassName == null ) { mv.visitIns("return null"); } else { // Handle inner classes contentClassName = contentClassName.replace('$','.'); CatchSourceCodeVisitor cv = mv.visitTry(); mv.visitVar("Object","content","new",contentClassName+"()"); mv.visitIns("return content"); cv = cv.visitCatch(Throwable.class,"t"); cv.visitIns( "throw","new",ChainedInstantiationException.class.getName(), "(t,null,\"\")" ); cv.visitEnd(); } }
@Override protected void generateContentChecks( BlockSourceCodeVisitor mv ) { String ctrlDesc = membraneDesc.getDescriptor(); String contentClassName = JuliacHelper.getContentClassName(ctrlDesc,contentDesc); if( contentClassName != null ) { InterfaceType[] its = ct.getFcInterfaceTypes(); for (int i = 0; i < its.length; i++) { if( ! its[i].isFcClientItf() ) { String signature = its[i].getFcItfSignature(); BlockSourceCodeVisitor then = mv.visitIf( "!",signature,".class.isAssignableFrom(", contentClassName,".class)"); then.visitVar( "String","msg","\""+contentClassName,"should implement", signature+"\""); then.visitIns( "throw","new", InstantiationException.class.getName()+"(msg)"); then.visitEnd(); } } } }