Search in sources :

Example 1 with SignatureWriter

use of org.objectweb.asm.signature.SignatureWriter in project buck by facebook.

the class SignatureFactory method getSignature.

/**
   * Returns the type signature of the given element. If none is required by the VM spec, returns
   * null.
   */
@Nullable
public String getSignature(Element element) {
    SignatureWriter writer = new SignatureWriter();
    element.accept(elementVisitorAdapter, writer);
    String result = writer.toString();
    return result.isEmpty() ? null : result;
}
Also used : SignatureWriter(org.objectweb.asm.signature.SignatureWriter) Nullable(javax.annotation.Nullable)

Example 2 with SignatureWriter

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

the class RenameClassAdapter method renameFieldSignature.

/**
     * Renames the FieldTypeSignature handled by ClassVisitor.visitField
     * or MethodVisitor.visitLocalVariable.
     */
String renameFieldSignature(String sig) {
    if (sig == null) {
        return null;
    }
    SignatureReader reader = new SignatureReader(sig);
    SignatureWriter writer = new SignatureWriter();
    reader.acceptType(new RenameSignatureAdapter(writer));
    sig = writer.toString();
    return sig;
}
Also used : SignatureReader(org.objectweb.asm.signature.SignatureReader) SignatureWriter(org.objectweb.asm.signature.SignatureWriter)

Example 3 with SignatureWriter

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

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 4 with SignatureWriter

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

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 5 with SignatureWriter

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

the class HttpHandlerGenerator method getClassSignature.

/**
   * Generates the class signature of the generate class. The generated class is not parameterized, however
   * it extends from {@link AbstractHttpHandlerDelegator} with parameterized type of the user http handler.
   *
   * @param delegateType Type of the user http handler
   * @return The signature string
   */
private String getClassSignature(TypeToken<?> delegateType) {
    SignatureWriter writer = new SignatureWriter();
    // Construct the superclass signature as "AbstractHttpHandlerDelegator<UserHandlerClass>"
    SignatureVisitor sv = writer.visitSuperclass();
    sv.visitClassType(Type.getInternalName(AbstractHttpHandlerDelegator.class));
    SignatureVisitor tv = sv.visitTypeArgument('=');
    tv.visitClassType(Type.getInternalName(delegateType.getRawType()));
    tv.visitEnd();
    sv.visitEnd();
    return writer.toString();
}
Also used : SignatureVisitor(org.objectweb.asm.signature.SignatureVisitor) 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