Package org.apache.xbean.asm4.shade.commons

Examples of org.apache.xbean.asm4.shade.commons.EmptyVisitor


        final String[] exceptions = new String[constructor.getExceptionTypes().length];
        for (int i = 0; i < exceptions.length; i++) {
            exceptions[i] = Type.getInternalName(constructor.getExceptionTypes()[i]);
        }

        final MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, "<init>", descriptor, null, exceptions);
        mv.visitCode();
        mv.visitVarInsn(ALOAD, 0);
        int index = 1;

        for (Type type : Type.getArgumentTypes(descriptor)) {
            mv.visitVarInsn(type.getOpcode(ILOAD), index);
            index += size(type);
        }

        mv.visitMethodInsn(INVOKESPECIAL, classFileName, "<init>", descriptor);

        mv.visitVarInsn(ALOAD, 0);
        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(PUTFIELD, proxyClassFileName, "this$handler", "Ljava/lang/reflect/InvocationHandler;");
        mv.visitInsn(RETURN);
        mv.visitMaxs(2, 1);
        return mv;
    }
View Full Code Here


            // now calculate the parameters
            int offset = 1;
            for (Class<?> aClass : delegatedMethod.getParameterTypes())
            {
                final Type type = Type.getType(aClass);
                mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
                offset += type.getSize();
            }

            // and finally invoke the target method on the provided Contextual Instance
            final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
            boolean interfaceMethod = Modifier.isInterface(delegatedMethod.getDeclaringClass().getModifiers());
            mv.visitMethodInsn(interfaceMethod ? Opcodes.INVOKEINTERFACE : Opcodes.INVOKEVIRTUAL,
                               declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor);

            generateReturn(mv, delegatedMethod);

            mv.visitMaxs(-1, -1);
View Full Code Here

            mv.visitFieldInsn(Opcodes.GETFIELD, proxyClassFileName, FIELD_PROXIED_INSTANCE, Type.getDescriptor(classToProxy));

            int offset = 1;
            for (Class<?> aClass : delegatedMethod.getParameterTypes())
            {
                final Type type = Type.getType(aClass);
                mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
                offset += type.getSize();
            }

            final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
            mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor);

            generateReturn(mv, delegatedMethod);

            mv.visitMaxs(-1, -1);
View Full Code Here

            // now calculate the parameters
            int offset = 1;
            for (Class<?> aClass : delegatedMethod.getParameterTypes())
            {
                final Type type = Type.getType(aClass);
                mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), offset);
                offset += type.getSize();
            }

            // and finally invoke the target method on the provided Contextual Instance
            final Type declaringClass = Type.getType(delegatedMethod.getDeclaringClass());
            if (abstractMethod)
            {
                // generate an empty return block
            }
            else
            {
                // invoke the method on the super class;
                mv.visitMethodInsn(Opcodes.INVOKESPECIAL, declaringClass.getInternalName(), delegatedMethod.getName(), methodDescriptor);
            }

            generateReturn(mv, delegatedMethod);

            mv.visitMaxs(-1, -1);
View Full Code Here

    @Override
    public void visit(final String name, final Object value) {
        if ("value".equals(name)) {
            if (value instanceof Type) {
                final Type type = (Type) value;
                final int sort = type.getSort();
                switch (sort) {
                    case Type.OBJECT:
                        if (type.getClassName().equals(ValidationRunner.class.getName())) {
                            classInfos.add(current);
                        }
                        break;
                }
            } else {
View Full Code Here

    public String getRelatedName() {
        return relatedName;
    }

    public String getDescriptor() {
        Type collectionType = cmrStyle.getCollectionType();
        if (collectionType == null) {
            return type.getDescriptor();
        }
        return collectionType.getDescriptor();
    }
View Full Code Here

        }
        return collectionType.getDescriptor();
    }

    public String getGenericSignature() {
        Type collectionType = cmrStyle.getCollectionType();
        if (collectionType == null) {
            return null;
        }
        return createSignature(collectionType, type);
    }
View Full Code Here

        }
        return createSignature(collectionType, type);
    }

    public String getProxyDescriptor() {
        Type collectionType = cmrStyle.getCollectionType();
        if (collectionType == null) {
            return proxyType.getDescriptor();
        }
        return collectionType.getDescriptor();
    }
View Full Code Here

    public String getAccessorDescriptor() {
        return cmrStyle.getAccessorType().getDescriptor();
    }

    public String getAccessorGenericSignature() {
        Type collectionType = cmrStyle.getCollectionType();
        if (collectionType == null) {
            return null;
        }
        return createSignature(cmrStyle.getAccessorType(), type, proxyType);
    }
View Full Code Here

                throw new IllegalArgumentException("No such property " + cmpFieldName + " defined on bean class " + beanClassName);
            }
            // if this is an abstract method, then it's one we have to generate
            if (Modifier.isAbstract(getter.getModifiers())) {

                Type type = Type.getType(getter.getReturnType());
                CmpField cmpField = new CmpField(cmpFieldName, type, getter);
                this.cmpFields.put(cmpFieldName, cmpField);
            }
            else {
                // the getter is non-abstract.  We only allow this if the class that
View Full Code Here

TOP

Related Classes of org.apache.xbean.asm4.shade.commons.EmptyVisitor

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.