Search in sources :

Example 6 with SignatureVisitor

use of org.objectweb.asm.signature.SignatureVisitor in project bytecode-viewer by Konloch.

the class CheckSignatureAdapter method visitSuperclass.

// class signatures
@Override
public SignatureVisitor visitSuperclass() {
    if (type != CLASS_SIGNATURE || (state & (EMPTY | FORMAL | BOUND)) == 0) {
        throw new IllegalArgumentException();
    }
    state = SUPER;
    SignatureVisitor v = sv == null ? null : sv.visitSuperclass();
    return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
}
Also used : SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor)

Example 7 with SignatureVisitor

use of org.objectweb.asm.signature.SignatureVisitor in project bytecode-viewer by Konloch.

the class CheckSignatureAdapter method visitClassBound.

@Override
public SignatureVisitor visitClassBound() {
    if (state != FORMAL) {
        throw new IllegalStateException();
    }
    state = BOUND;
    SignatureVisitor v = sv == null ? null : sv.visitClassBound();
    return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
}
Also used : SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor)

Example 8 with SignatureVisitor

use of org.objectweb.asm.signature.SignatureVisitor in project bytecode-viewer by Konloch.

the class CheckSignatureAdapter method visitReturnType.

@Override
public SignatureVisitor visitReturnType() {
    if (type != METHOD_SIGNATURE || (state & (EMPTY | FORMAL | BOUND | PARAM)) == 0) {
        throw new IllegalArgumentException();
    }
    state = RETURN;
    SignatureVisitor v = sv == null ? null : sv.visitReturnType();
    CheckSignatureAdapter cv = new CheckSignatureAdapter(TYPE_SIGNATURE, v);
    cv.canBeVoid = true;
    return cv;
}
Also used : SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor)

Example 9 with SignatureVisitor

use of org.objectweb.asm.signature.SignatureVisitor in project bytecode-viewer by Konloch.

the class CheckSignatureAdapter method visitArrayType.

@Override
public SignatureVisitor visitArrayType() {
    if (type != TYPE_SIGNATURE || state != EMPTY) {
        throw new IllegalStateException();
    }
    state = SIMPLE_TYPE;
    SignatureVisitor v = sv == null ? null : sv.visitArrayType();
    return new CheckSignatureAdapter(TYPE_SIGNATURE, v);
}
Also used : SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor)

Example 10 with SignatureVisitor

use of org.objectweb.asm.signature.SignatureVisitor in project jqa-java-plugin by buschmais.

the class ClassVisitor method visitField.

@Override
public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) {
    final FieldDescriptor fieldDescriptor = visitorHelper.getFieldDescriptor(cachedType, SignatureHelper.getFieldSignature(name, desc));
    fieldDescriptor.setName(name);
    fieldDescriptor.setVolatile(hasFlag(access, Opcodes.ACC_VOLATILE));
    fieldDescriptor.setTransient(hasFlag(access, Opcodes.ACC_TRANSIENT));
    setModifiers(access, fieldDescriptor);
    if (signature == null) {
        TypeDescriptor type = visitorHelper.resolveType(SignatureHelper.getType((desc)), cachedType).getTypeDescriptor();
        fieldDescriptor.setType(type);
    } else {
        new SignatureReader(signature).accept(new AbstractTypeSignatureVisitor(cachedType, visitorHelper) {

            @Override
            public SignatureVisitor visitArrayType() {
                return dependentTypeSignatureVisitor;
            }

            @Override
            public SignatureVisitor visitTypeArgument(char wildcard) {
                return dependentTypeSignatureVisitor;
            }

            @Override
            public SignatureVisitor visitSuperclass() {
                return this;
            }

            @Override
            public void visitEnd(TypeDescriptor resolvedTypeDescriptor) {
                fieldDescriptor.setType(resolvedTypeDescriptor);
            }
        });
    }
    if (value != null) {
        if (value instanceof org.objectweb.asm.Type) {
            visitorHelper.resolveType(SignatureHelper.getType((org.objectweb.asm.Type) value), cachedType);
        }
        PrimitiveValueDescriptor valueDescriptor = visitorHelper.getValueDescriptor(PrimitiveValueDescriptor.class);
        valueDescriptor.setValue(value);
        fieldDescriptor.setValue(valueDescriptor);
    }
    return new FieldVisitor(cachedType, fieldDescriptor, visitorHelper);
}
Also used : SignatureReader(org.objectweb.asm.signature.SignatureReader) SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor)

Aggregations

SignatureVisitor (org.objectweb.asm.signature.SignatureVisitor)13 SignatureWriter (org.objectweb.asm.signature.SignatureWriter)6 SignatureReader (org.objectweb.asm.signature.SignatureReader)3 ParameterizedType (java.lang.reflect.ParameterizedType)2 Type (org.objectweb.asm.Type)1