Package org.objectweb.asm

Examples of org.objectweb.asm.ClassWriter.visitSource()


    private ClassWriter createBlockCtor(String namePath, String classname) {
        String ciClassname = "L" + classname + ";";
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
        cw.visit(RubyInstanceConfig.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER, namePath, null, p(CompiledBlockCallback.class), null);
        cw.visitSource(namePath, null);
        cw.visitField(ACC_PRIVATE | ACC_FINAL, "$scriptObject", ciClassname, null, null);
        SkinnyMethodAdapter mv = new SkinnyMethodAdapter(cw, ACC_PUBLIC, "<init>", sig(Void.TYPE, params(Object.class)), null, null);
        mv.start();
        mv.line(-1);
        mv.aload(0);
View Full Code Here


    private ClassWriter createBlockCtor19(String namePath, String classname) {
        String ciClassname = "L" + classname + ";";
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
        cw.visit(RubyInstanceConfig.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER, namePath, null, p(Object.class), new String[] {p(CompiledBlockCallback19.class)});
        cw.visitSource(namePath, null);
        cw.visitField(ACC_PRIVATE | ACC_FINAL, "$scriptObject", ciClassname, null, null);
        SkinnyMethodAdapter mv = new SkinnyMethodAdapter(cw, ACC_PUBLIC, "<init>", sig(Void.TYPE, params(Object.class)), null, null);
        mv.start();
        mv.line(-1);
        mv.aload(0);
View Full Code Here

    }

    private ClassWriter createCompiledCtor(String namePath, String shortPath, String sup) {
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
        cw.visit(RubyInstanceConfig.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER, namePath, null, sup, null);
        cw.visitSource(shortPath, null);
        SkinnyMethodAdapter mv = new SkinnyMethodAdapter(cw, ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitCode();
        mv.line(-1);
        mv.aload(0);
        mv.visitMethodInsn(INVOKESPECIAL, sup, "<init>", "()V");
View Full Code Here

    private ClassWriter createJavaMethodCtor(String namePath, String shortPath, String sup) throws Exception {
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
        String sourceFile = namePath.substring(namePath.lastIndexOf('/') + 1) + ".gen";
        cw.visit(RubyInstanceConfig.JAVA_VERSION, ACC_PUBLIC + ACC_SUPER, namePath, null, sup, null);
        cw.visitSource(sourceFile, null);
        SkinnyMethodAdapter mv = new SkinnyMethodAdapter(cw, ACC_PUBLIC, "<init>", JAVA_SUPER_SIG, null, null);
        mv.start();
        mv.line(-1);
        mv.aloadMany(0, 1, 2);
        mv.visitMethodInsn(INVOKESPECIAL, sup, "<init>", JAVA_SUPER_SIG);
View Full Code Here

        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
        String pathName = name.replace('.', '/');
       
        // construct the class, implementing all supertypes
        cw.visit(V1_5, ACC_PUBLIC | ACC_SUPER, pathName, null, p(Object.class), superTypeNames);
        cw.visitSource(pathName + ".gen", null);
       
        // fields needed for dispatch and such
        cw.visitField(ACC_STATIC | ACC_FINAL | ACC_PRIVATE, "$runtimeCache", ci(RuntimeCache.class), null, null).visitEnd();
        cw.visitField(ACC_PRIVATE | ACC_FINAL, "$self", ci(IRubyObject.class), null, null).visitEnd();
View Full Code Here

            plusIRubyObject[0] = p(IRubyObject.class);
            System.arraycopy(superTypeNames, 0, plusIRubyObject, 1, superTypeNames.length);
           
            cw.visit(V1_5, ACC_PUBLIC | ACC_SUPER, pathName, null, p(superClass), plusIRubyObject);
        }
        cw.visitSource(pathName + ".gen", null);

        // fields needed for dispatch and such
        cw.visitField(ACC_STATIC | ACC_FINAL | ACC_PRIVATE, "$runtimeCache", ci(RuntimeCache.class), null, null).visitEnd();

        // create static init
View Full Code Here

            MethodVisitor mv;
            AnnotationVisitor av0;
   
            cw.visit(V1_6, ACC_ABSTRACT + ACC_INTERFACE + ACC_SYNTHETIC, internalClassName, null, "java/lang/Object", null);
   
            cw.visitSource("package-info.java", null);
   

            av0 = cw.visitAnnotation("Ljavax/xml/bind/annotation/XmlSchema;", true);
            av0.visit("namespace", namespace);
            av0.visitEnd();
View Full Code Here

            ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
            String superClass = internalClassName(OptimizedValueInstantiator.class.getName());
            String generatedClass = internalClassName(srcName);
           
            cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, generatedClass, null, superClass, null);
            cw.visitSource(srcName + ".java", null);

            // First: must define 2 constructors:
            // (a) default constructor, for creating bogus instance (just calls default instance)
            // (b) copy-constructor which takes StdValueInstantiator instance, passes to superclass
            final String optimizedValueInstDesc = Type.getDescriptor(OptimizedValueInstantiator.class);
View Full Code Here

        String classname = pkg + "/GeneratedUnsafe";
        String classpath = dir + "/GeneratedUnsafe.class";
       
        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES);
        cw.visit(V1_5, ACC_PUBLIC + ACC_SUPER, classname, null, p(Object.class), new String[] {p(Unsafe.class)});
        cw.visitSource("<generated>", null);
       
        SkinnyMethodAdapter method = new SkinnyMethodAdapter(cw, ACC_PUBLIC, "<init>", sig(void.class), null, null);
        method.start();
        method.line(0);
        method.aload(0);
View Full Code Here

                "pkg/Debug",
                null,
                "java/lang/Object",
                new String[] { "java/io/Serializable" });

        cw.visitSource("Debug.java", "source-debug");

        FieldVisitor fv = cw.visitField(ACC_FINAL + ACC_STATIC,
                "serialVersionUID",
                "J",
                null,
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.