Package org.cojen.classfile

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


            throw new IllegalArgumentException("No methods in factory to implement");
        }

        F instance;
        try {
            instance = (F) cf.defineClass().newInstance();
        } catch (IllegalAccessException e) {
            throw new UndeclaredThrowableException(e);
        } catch (InstantiationException e) {
            throw new UndeclaredThrowableException(e);
        }
View Full Code Here


        endLabel.setLocation();
        builder.loadConstant(0);
        builder.returnValue(TypeDesc.INT);

        return cf.defineClass();
    }

    private static void generatePrimitiveComparison(CodeBuilder builder,
                                                    Class type,
                                                    LocalVariable a,
View Full Code Here

                    (cf.addMethod(Modifiers.PUBLIC, m.getName(), MethodDesc.forMethod(m)));
                addWrappedCall(cf, b, m);
            }
        }

        Class<T> clazz = cf.defineClass();
        return clazz;
    }

    private void addWrappedCall(ClassFile cf, CodeBuilder b, Method m) {
        // Special behavior for equals method
View Full Code Here

        endLabel.setLocation();
        builder.loadConstant(0);
        builder.returnValue(TypeDesc.INT);

        return cf.defineClass();
    }

    private static void generatePrimitiveComparison(CodeBuilder builder,
                                                    Class type,
                                                    LocalVariable a,
View Full Code Here

                    (cf.addMethod(Modifiers.PUBLIC, m.getName(), MethodDesc.forMethod(m)));
                addWrappedCall(cf, b, m);
            }
        }

        Class<T> clazz = cf.defineClass();
        return clazz;
    }

    private void addWrappedCall(ClassFile cf, CodeBuilder b, Method m) {
        // Special behavior for equals method
View Full Code Here

            throw new IllegalArgumentException("No methods in factory to implement");
        }

        F instance;
        try {
            instance = (F) cf.defineClass().newInstance();
        } catch (IllegalAccessException e) {
            throw new UndeclaredThrowableException(e);
        } catch (InstantiationException e) {
            throw new UndeclaredThrowableException(e);
        }
View Full Code Here

            (cf.addMethod(Modifiers.PROTECTED, "doFire",
                          null, new TypeDesc[] {TypeDesc.forClass(Throwable.class)}));
        b.loadLocal(b.getParameter(0));
        b.throwObject();
        try {
            return (ThrowUnchecked) cf.defineClass().newInstance();
        } catch (Exception e) {
            throw new Error(e);
        }
    }
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.