Package org.cojen.classfile

Examples of org.cojen.classfile.RuntimeClassFile.addMethod()


                cf.markSynthetic();
                cf.addDefaultConstructor();
            }

            // Now define the method that constructs the object.
            CodeBuilder b = new CodeBuilder(cf.addMethod(method));
            b.newObject(TypeDesc.forClass(objectType));
            b.dup();
            int count = b.getParameterCount();
            for (int i=0; i<count; i++) {
                b.loadLocal(b.getParameter(i));
View Full Code Here


            mIntArrayType = TypeDesc.INT.toArrayType();

            // fillMatchResults method
            TypeDesc charArrayType = TypeDesc.CHAR.toArrayType();
            params = new TypeDesc[]{charArrayType, mIntType, mListType};
            mi = cf.addMethod(Modifiers.PUBLIC, "fillMatchResults", null, params);
            mBuilder = new CodeBuilder(mi);

            mLookupLocal = mBuilder.getParameter(0);
            mLimitLocal = mBuilder.getParameter(1);
            mResultsLocal = mBuilder.getParameter(2);
View Full Code Here

                ("compareTo", new Class[] {Object.class});
        } catch (NoSuchMethodException e) {
            throw new InternalError(e.toString());
        }

        MethodInfo mi = cf.addMethod(compareMethod);
        mi.markSynthetic();
        builder = new CodeBuilder(mi);

        Label endLabel = builder.createLabel();
        LocalVariable obj1 = builder.getParameter(0);
View Full Code Here

                // Defined in object too, so skip it for now
                continue;
            } catch (NoSuchMethodException e) {
            }

            addWrappedCall(cf, new CodeBuilder(cf.addMethod(m)), m);
        }

        // Also wrap non-final public methods from Object. mType is an
        // interface, so we don't have to worry about any superclasses --
        // except Object.  We want to make sure that all (non-final) Object
View Full Code Here

        for (Method m : Object.class.getMethods()) {
            int modifiers = m.getModifiers();
            if (!Modifier.isFinal(modifiers) && Modifier.isPublic(modifiers)) {
                b = new CodeBuilder
                    (cf.addMethod(Modifiers.PUBLIC, m.getName(), MethodDesc.forMethod(m)));
                addWrappedCall(cf, b, m);
            }
        }

        Class<T> clazz = cf.defineClass();
View Full Code Here

                ("compareTo", new Class[] {Object.class});
        } catch (NoSuchMethodException e) {
            throw new InternalError(e.toString());
        }

        MethodInfo mi = cf.addMethod(compareMethod);
        mi.markSynthetic();
        builder = new CodeBuilder(mi);

        Label endLabel = builder.createLabel();
        LocalVariable obj1 = builder.getParameter(0);
View Full Code Here

                // Defined in object too, so skip it for now
                continue;
            } catch (NoSuchMethodException e) {
            }

            addWrappedCall(cf, new CodeBuilder(cf.addMethod(m)), m);
        }

        // Also wrap non-final public methods from Object. mType is an
        // interface, so we don't have to worry about any superclasses --
        // except Object.  We want to make sure that all (non-final) Object
View Full Code Here

        for (Method m : Object.class.getMethods()) {
            int modifiers = m.getModifiers();
            if (!Modifier.isFinal(modifiers) && Modifier.isPublic(modifiers)) {
                b = new CodeBuilder
                    (cf.addMethod(Modifiers.PUBLIC, m.getName(), MethodDesc.forMethod(m)));
                addWrappedCall(cf, b, m);
            }
        }

        Class<T> clazz = cf.defineClass();
View Full Code Here

            mIntArrayType = TypeDesc.INT.toArrayType();

            // fillMatchResults method
            TypeDesc charArrayType = TypeDesc.CHAR.toArrayType();
            params = new TypeDesc[]{charArrayType, mIntType, mListType};
            mi = cf.addMethod(Modifiers.PUBLIC, "fillMatchResults", null, params);
            mBuilder = new CodeBuilder(mi);

            mLookupLocal = mBuilder.getParameter(0);
            mLimitLocal = mBuilder.getParameter(1);
            mResultsLocal = mBuilder.getParameter(2);
View Full Code Here

                cf.markSynthetic();
                cf.addDefaultConstructor();
            }

            // Now define the method that constructs the object.
            CodeBuilder b = new CodeBuilder(cf.addMethod(method));
            b.newObject(TypeDesc.forClass(objectType));
            b.dup();
            int count = b.getParameterCount();
            for (int i=0; i<count; i++) {
                b.loadLocal(b.getParameter(i));
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.