Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.InstructionFactory


     * @param klass the class
     */
    public void transformInterface(final Context context, final Klass klass) {
        final ClassGen cg = klass.getClassGen();
            final ConstantPoolGen cpg = cg.getConstantPool();
            final InstructionFactory factory = new InstructionFactory(cg);

            if (classFilter(cg)) {
                return;
            }
            if (m_hasBeenTransformed.contains(cg.getClassName())) {
View Full Code Here


            return;
        }
        m_transformed.add(cg.getClassName());

        final ConstantPoolGen cpg = cg.getConstantPool();
        final InstructionFactory factory = new InstructionFactory(cg);
        addIntroductions(context, cg, cpg, factory);
    }
View Full Code Here

            }
        }

        final ConstantPoolGen cpg = cg.getConstantPool();
        final String className = cg.getClassName();
        final InstructionFactory factory = new InstructionFactory(cg);

        final Set setFieldJoinPoints = new HashSet();
        final Set getFieldJoinPoints = new HashSet();

        boolean isClassAdvised = false;
View Full Code Here

                break;
            }
        }
        final ConstantPoolGen cpg = cg.getConstantPool();
        final String className = cg.getClassName();
        final InstructionFactory factory = new InstructionFactory(cg);

        final Set callerSideJoinPoints = new HashSet();

        Method clInitMethod = null;
        final Map methodSequences = new HashMap();
View Full Code Here

/*  99 */     this.superClassName = superClassName;
/* 100 */     this.proxyClassName = proxyClassName;
/*     */
/* 102 */     PROXY_CLASS_T = new ObjectType(proxyClassName);
/* 103 */     this.constPool = cg.getConstantPool();
/* 104 */     this.iFactory = new InstructionFactory(cg, this.constPool);
/*     */   }
View Full Code Here

      _cg = new ClassGen(peerName, "gov.nasa.jpf.vm.NativePeer", peerName + ".class", Constants.ACC_PUBLIC, new String[] {});
      _cg.addEmptyConstructor(Constants.ACC_PUBLIC);
    }

    _cp = _cg.getConstantPool();
    _factory = new InstructionFactory(_cg, _cp);

    // if (!NativePeer.peers.containsKey(className))
    // _cg.addEmptyConstructor(Constants.ACC_PUBLIC);

    PeerClassGen.Peers.put(className, this);
View Full Code Here

            }
        }

        ClassGen cg = new ClassGen( jc );
        ConstantPoolGen cp = cg.getConstantPool();
        InstructionFactory _factory = new InstructionFactory( cg, cp );

        Method[] methods = cg.getMethods();
        for ( Method method : methods )
        {
            Type[] types = method.getArgumentTypes();
            if ( method.getName().equals( "setLogger" ) && types.length == 1
                && types[0].equals( Type.getType( "Lflex2/compiler/Logger;" ) ) )
            {
                InstructionList il = new InstructionList();
                MethodGen mg =
                    new MethodGen( method.getAccessFlags(), method.getReturnType(), method.getArgumentTypes(), null,
                                   method.getName(), null, il, cp );

                il.append( InstructionFactory.createLoad( Type.OBJECT, 0 ) );
                il.append( _factory.createInvoke( FLEXMOJOS_HELPER, "fixLogger",
                                                  new ObjectType( "flex2.compiler.Logger" ),
                                                  new Type[] { new ObjectType( "flex2.compiler.Logger" ) },
                                                  Constants.INVOKESTATIC ) );
                il.append( InstructionFactory.createStore( Type.OBJECT, 0 ) );

                il.append( _factory.createFieldAccess( THREAD_LOCAL_TOOLKIT, "logger",
                                                       new ObjectType( "java.lang.ThreadLocal" ), Constants.GETSTATIC ) );
                il.append( InstructionFactory.createLoad( Type.OBJECT, 0 ) );
                il.append( _factory.createInvoke( "java.lang.ThreadLocal", "set", Type.VOID,
                                                  new Type[] { Type.OBJECT }, Constants.INVOKEVIRTUAL ) );
                il.append( InstructionFactory.createLoad( Type.OBJECT, 0 ) );
                BranchInstruction ifnull_13 = InstructionFactory.createBranchInstruction( Constants.IFNULL, null );
                il.append( ifnull_13 );
                il.append( InstructionFactory.createLoad( Type.OBJECT, 0 ) );
                il.append( _factory.createInvoke( THREAD_LOCAL_TOOLKIT, "getLocalizationManager",
                                                  new ObjectType( "flash.localization.LocalizationManager" ),
                                                  Type.NO_ARGS, Constants.INVOKESTATIC ) );
                il.append( _factory.createInvoke( "flex2.compiler.Logger",
                                                  "setLocalizationManager",
                                                  Type.VOID,
                                                  new Type[] { new ObjectType( "flash.localization.LocalizationManager" ) },
                                                  Constants.INVOKEINTERFACE ) );
                InstructionHandle ih_25 = il.append( InstructionFactory.createReturn( Type.VOID ) );
                ifnull_13.setTarget( ih_25 );
                mg.setMaxStack();
                mg.setMaxLocals();

                cg.removeMethod( method );
                cg.addMethod( mg.getMethod() );

                il.dispose();
            }
            else if ( method.getName().equals( "setPathResolver" ) && types.length == 1
                && types[0].equals( new ObjectType( "flex2.compiler.common.PathResolver" ) ) )
            {
                InstructionList il = new InstructionList();
                MethodGen mg =
                    new MethodGen( method.getAccessFlags(), method.getReturnType(), method.getArgumentTypes(), null,
                                   method.getName(), null, il, cp );

                il.append( InstructionFactory.createLoad( Type.OBJECT, 0 ) );
                il.append( _factory.createInvoke( FLEXMOJOS_HELPER,
                                                  "fixPathResolver",
                                                  new ObjectType( "flex2.compiler.common.PathResolver" ),
                                                  new Type[] { new ObjectType( "flex2.compiler.common.PathResolver" ) },
                                                  Constants.INVOKESTATIC ) );
                il.append( InstructionFactory.createStore( Type.OBJECT, 0 ) );

                il.append( _factory.createFieldAccess( THREAD_LOCAL_TOOLKIT, "resolver",
                                                       new ObjectType( "java.lang.ThreadLocal" ), Constants.GETSTATIC ) );
                il.append( InstructionFactory.createLoad( Type.OBJECT, 0 ) );
                il.append( _factory.createInvoke( "java.lang.ThreadLocal", "set", Type.VOID,
                                                  new Type[] { Type.OBJECT }, Constants.INVOKEVIRTUAL ) );
                il.append( InstructionFactory.createReturn( Type.VOID ) );

                mg.setMaxStack();
                mg.setMaxLocals();
View Full Code Here

        m_definition.loadAspects(context.getLoader());

        final ClassGen cg = klass.getClassGen();
        final ConstantPoolGen cpg = cg.getConstantPool();
        final InstructionFactory factory = new InstructionFactory(cg);

        ClassMetaData classMetaData = BcelMetaDataMaker.createClassMetaData(context.getJavaClass(cg));

        if (classFilter(classMetaData, cg)) {
            return;
View Full Code Here

        }
        if (cg.containsField(TransformationUtil.META_DATA_FIELD) == null) {
            return;
        }

        final InstructionFactory factory = new InstructionFactory(cg);
        final ConstantPoolGen cpg = cg.getConstantPool();
        final Method[] methods = cg.getMethods();

        // get the indexes for the <init> methods
        List initIndexes = new ArrayList();
View Full Code Here

            if (classFilter(definition, classMetaData, cg)) {
                return;
            }

            final InstructionFactory factory = new InstructionFactory(cg);
            final ConstantPoolGen cpg = cg.getConstantPool();
            final Method[] methods = cg.getMethods();

            // get the indexes for the <init> methods
            List initIndexes = new ArrayList();
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.InstructionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.