How do I get this...

private void createMethod_11() {
        InstructionList il = new InstructionList();
        MethodGen method = new MethodGen(ACC_STATIC | ACC_FINAL,
Type.VOID, Type.NO_ARGS, new String[] {}, "<clinit>",
                className, il, _cp);
        il.append(_factory.createFieldAccess(className, "class$L" +
className.replace('.', '$'), new ObjectType(
                "java.lang.Class"), Constants.GETSTATIC));
        il.append(_factory.createFieldAccess(className,
"XMLC_GENERATED_CLASS",
                new ObjectType("java.lang.Class"), Constants.PUTSTATIC));
        il.append(_factory.createFieldAccess(className,
"class$Lorg$enhydra$xml$xmlc$dom$xerces$XercesHTMLDomFactory",
new ObjectType("java.lang.Class"),
                Constants.GETSTATIC));
        
il.append(_factory.createInvoke("org.enhydra.xml.xmlc.dom.XMLCDomFactoryCache",
                "getFactory", new
ObjectType("org.enhydra.xml.xmlc.dom.XMLCDomFactory"), new Type[] { new
ObjectType(
                        "java.lang.Class") }, Constants.INVOKESTATIC));
        il.append(_factory.createFieldAccess(className, "fDOMFactory", new
ObjectType(
                "org.enhydra.xml.xmlc.dom.XMLCDomFactory"),
Constants.PUTSTATIC));
        il.append(InstructionFactory.createReturn(Type.VOID));
        method.setMaxStack();
        method.setMaxLocals();
        _cg.addMethod(method.getMethod());
        il.dispose();
    }

to generate this...

    static  {
        XMLC_GENERATED_CLASS = $$XMLC_GENERATED$$.dyna.dyna01.html.class;
        fDOMFactory =
XMLCDomFactoryCache.getFactory(org.enhydra.xml.xmlc.dom.xerces.XercesHTMLDomFactory.class);
    }

currently, it is generating this...

    static final  {
        XMLC_GENERATED_CLASS = class$L$$XMLC_GENERATED$$$dyna$dyna01$html;
        fDOMFactory =
XMLCDomFactoryCache.getFactory(class$Lorg$enhydra$xml$xmlc$dom$xerces$XercesHTMLDomFactory);
    }


The class was originally generated by the BCELifier (by someone else on our team) based on an example generated XMLC ( http://xmlc.objectweb.org/ ) class. We tweaked it for our purposes, but the code in the block above never really worked so we had it commented out (I also removed bits to avoid generating code that didn't need to be generated and got it slimmed down to the code you see above). However, that means that some functionality isn't available where it works just fine for the ASM2 version (built with the ASMifier). I would like the two to generate nearly identical code and this is the last little bit that I need to get working. Can someone please point out the syntax needed to generate the proper code (like the former, which is spit out by the ASM2 version) rather than the improper code (like the latter, generated by the BCEL code above, which is clearly incorrect, but I'm just not familiar enough with these bytecode tools to know what the proper syntax is).

thanks,


Jake




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to