Search in sources :

Example 1 with SignatureVisitor

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

the class Remapper method mapSignature.

/**
     * 
     * @param typeSignature
     *            true if signature is a FieldTypeSignature, such as the
     *            signature parameter of the ClassVisitor.visitField or
     *            MethodVisitor.visitLocalVariable methods
     */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createRemappingSignatureAdapter(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
Also used : SignatureReader(org.objectweb.asm.signature.SignatureReader) SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor) SignatureWriter(org.objectweb.asm.signature.SignatureWriter)

Example 2 with SignatureVisitor

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

the class CheckSignatureAdapter method visitParameterType.

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

Example 3 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 4 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 5 with SignatureVisitor

use of org.objectweb.asm.signature.SignatureVisitor in project cdap by caskdata.

the class FieldAccessorGenerator method getterSignature.

/**
 * @return the getter signature {@code <T> T get(Object object)}
 */
private String getterSignature() {
    SignatureWriter writer = new SignatureWriter();
    writer.visitFormalTypeParameter("T");
    SignatureVisitor sv = writer.visitClassBound();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();
    sv = writer.visitParameterType();
    sv.visitClassType(Type.getInternalName(Object.class));
    sv.visitEnd();
    sv = sv.visitReturnType();
    sv.visitTypeVariable("T");
    return writer.toString();
}
Also used : SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor) SignatureWriter(org.objectweb.asm.signature.SignatureWriter)

Aggregations

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