Search in sources :

Example 6 with SignatureWriter

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

the class Signatures method getFieldSignature.

public static String getFieldSignature(TypeToken<?> fieldType) {
    SignatureWriter signWriter = new SignatureWriter();
    signWriter.visitClassType(Type.getInternalName(fieldType.getRawType()));
    if (fieldType.getType() instanceof ParameterizedType) {
        for (java.lang.reflect.Type paramType : ((ParameterizedType) fieldType.getType()).getActualTypeArguments()) {
            signWriter.visitTypeArgument(SignatureVisitor.INSTANCEOF);
            visitTypeSignature(fieldType.resolveType(paramType), signWriter);
        }
    }
    signWriter.visitEnd();
    return signWriter.toString();
}
Also used : ParameterizedType(java.lang.reflect.ParameterizedType) SignatureWriter(org.objectweb.asm.signature.SignatureWriter)

Example 7 with SignatureWriter

use of org.objectweb.asm.signature.SignatureWriter 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)

Example 8 with SignatureWriter

use of org.objectweb.asm.signature.SignatureWriter 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 9 with SignatureWriter

use of org.objectweb.asm.signature.SignatureWriter in project platform_frameworks_base by android.

the class AbstractClassAdapter method renameTypeSignature.

/**
     * Renames the ClassSignature handled by ClassVisitor.visit
     * or the MethodTypeSignature handled by ClassVisitor.visitMethod.
     */
String renameTypeSignature(String sig) {
    if (sig == null) {
        return null;
    }
    SignatureReader reader = new SignatureReader(sig);
    SignatureWriter writer = new SignatureWriter();
    reader.accept(new RenameSignatureAdapter(writer));
    sig = writer.toString();
    return sig;
}
Also used : SignatureReader(org.objectweb.asm.signature.SignatureReader) SignatureWriter(org.objectweb.asm.signature.SignatureWriter)

Example 10 with SignatureWriter

use of org.objectweb.asm.signature.SignatureWriter in project android_frameworks_base by ParanoidAndroid.

the class RenameClassAdapter method renameTypeSignature.

/**
     * Renames the ClassSignature handled by ClassVisitor.visit
     * or the MethodTypeSignature handled by ClassVisitor.visitMethod.
     */
String renameTypeSignature(String sig) {
    if (sig == null) {
        return null;
    }
    SignatureReader reader = new SignatureReader(sig);
    SignatureWriter writer = new SignatureWriter();
    reader.accept(new RenameSignatureAdapter(writer));
    sig = writer.toString();
    return sig;
}
Also used : SignatureReader(org.objectweb.asm.signature.SignatureReader) SignatureWriter(org.objectweb.asm.signature.SignatureWriter)

Aggregations

SignatureWriter (org.objectweb.asm.signature.SignatureWriter)15 SignatureReader (org.objectweb.asm.signature.SignatureReader)8 SignatureVisitor (org.objectweb.asm.signature.SignatureVisitor)6 ParameterizedType (java.lang.reflect.ParameterizedType)3 Nullable (javax.annotation.Nullable)1 Type (org.objectweb.asm.Type)1