Package org.objectweb.asm

Examples of org.objectweb.asm.FieldVisitor


        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }

    private void createField(String propertyName, Type asmType, int access) {
        FieldVisitor fv = classVisitor.visitField(
                access,
                getPropertyField(propertyName),
                asmType.getDescriptor(),
                null,
                null);
        fv.visitEnd();
    }
View Full Code Here


        mv.visitMaxs(1, 1);
        mv.visitEnd();
    }

    private void createField(String propertyName, Type asmType, int access) {
        FieldVisitor fv = classVisitor.visitField(
                access,
                getPropertyField(propertyName),
                asmType.getDescriptor(),
                null,
                null);
        fv.visitEnd();
    }
View Full Code Here

     * Makes the given class visitor visit this field.
     *
     * @param cv a class visitor.
     */
    public void accept(final ClassVisitor cv) {
        FieldVisitor fv = cv.visitField(access, name, desc, signature, value);
        if (fv == null) {
            return;
        }
        int i, n;
        n = visibleAnnotations == null ? 0 : visibleAnnotations.size();
        for (i = 0; i < n; ++i) {
            AnnotationNode an = visibleAnnotations.get(i);
            an.accept(fv.visitAnnotation(an.desc, true));
        }
        n = invisibleAnnotations == null ? 0 : invisibleAnnotations.size();
        for (i = 0; i < n; ++i) {
            AnnotationNode an = invisibleAnnotations.get(i);
            an.accept(fv.visitAnnotation(an.desc, false));
        }
        n = attrs == null ? 0 : attrs.size();
        for (i = 0; i < n; ++i) {
            fv.visitAttribute(attrs.get(i));
        }
        fv.visitEnd();
    }
View Full Code Here

        Printer p = this.p.visitField(access,
                name,
                desc,
                signature,
                value);
        FieldVisitor fv = cv == null ? null : cv.visitField(access,
                name,
                desc,
                signature,
                value);
        return new TraceFieldVisitor(fv, p);
View Full Code Here

        // transform Foo.class to foo$(class) for 1.2 compatibility
        String ldcName = ((Type) cst).getInternalName();
        String fieldName = "class$" + ldcName.replace('/', '$');

        FieldVisitor fv = classOptimizer.syntheticFieldVisitor(ACC_STATIC | ACC_SYNTHETIC,
                fieldName, "Ljava/lang/Class;");
        fv.visitEnd();

        if (!classOptimizer.class$) {
            MethodVisitor mv = classOptimizer.visitMethod(ACC_STATIC | ACC_SYNTHETIC,
                    "class$", "(Ljava/lang/String;)Ljava/lang/Class;", null, null);
            mv.visitCode();
View Full Code Here

        String name,
        String desc,
        String signature,
        Object value)
    {
        FieldVisitor fv = super.visitField(access,
                remapper.mapFieldName(className, name, desc),
                remapper.mapDesc(desc),
                remapper.mapSignature(signature, true),
                remapper.mapValue(value));
        return fv == null ? null : createRemappingFieldAdapter(fv);
View Full Code Here

            CheckMethodAdapter.checkFieldSignature(signature);
        }
        if (value != null) {
            CheckMethodAdapter.checkConstant(value);
        }
        FieldVisitor av = super.visitField(access, name, desc, signature, value);
        return new CheckFieldAdapter(av);
    }
View Full Code Here

      /*
       * Generate the synthetic "hostedModeReferece" field to contain the
       * underlying real reference to the JavaScript object.
       */
      FieldVisitor fv = visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC,
          HostedModeClassRewriter.REFERENCE_FIELD, "Ljava/lang/Object;", null,
          null);
      if (fv != null) {
        fv.visitEnd();
      }

      // Implement the trampoline methods
      for (String mangledName : jsoData.getMangledNames()) {
        List<Method> declarations = jsoData.getDeclarations(mangledName);
View Full Code Here

    }
    private static void addConstructor(String newClassName, ClassWriter cw,  Class<?> objectFactory) {
       
        if (objectFactory != null) {
            String ofName = "L" + periodToSlashes(objectFactory.getName()) + ";";
            FieldVisitor fv = cw.visitField(0, "factory",
                                            ofName,
                                            null, null);
            fv.visitEnd();
        }
       
        MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);
        mv.visitCode();
        Label l0 = new Label();
View Full Code Here

    if (this.staticContextBuilt) return;
    this.staticContextBuilt = true;

    final SectionCompiler root = engineCompiler().rootCompiler();
    final ClassWriter cw = root.cw();
    final FieldVisitor fv = cw.visitField( Opcodes.ACC_STATIC + Opcodes.ACC_FINAL, RUNTIME_CONTEXT_NAME,
        RUNTIME_CONTEXT_TYPE.getDescriptor(), null, null );
    fv.visitEnd();

    final GeneratorAdapter mv = root.initializer();
    mv.visitTypeInsn( Opcodes.NEW, RUNTIME_CONTEXT_TYPE.getInternalName() );
    mv.visitInsn( Opcodes.DUP );
    mv.push( numericType().scale() );
View Full Code Here

TOP

Related Classes of org.objectweb.asm.FieldVisitor

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.