Java 类org.objectweb.asm.signature.SignatureWriter 实例源码

项目:annotation-tools    文件:SignatureTest.java   
public void test() throws Exception {
    if (line.length() > 2) {
        String signature = line.substring(2);
        SignatureWriter wrt = new SignatureWriter();
        SignatureReader rdr = new SignatureReader(signature);
        switch (line.charAt(0)) {
            case 'C':
            case 'M':
                rdr.accept(wrt);
                break;
            case 'T':
                rdr.acceptType(wrt);
                break;
            default:
                return;
        }
        assertEquals(signature, wrt.toString());
    }
}
项目:CodenameOne    文件:NameTranslatorClassVisitor.java   
private String translateSignature(final String signature, boolean type) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter() {
        public void visitClassType(final String name) {
            String n = translator.getClassMirrorTranslation(name);
            super.visitClassType(n);
        }
    };

    if (type) {
        r.acceptType(w);        
    } else {
        r.accept(w);        
    }
    return w.toString();
}
项目:cn1    文件:NameTranslatorClassVisitor.java   
private String translateSignature(final String signature, boolean type) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter() {
        public void visitClassType(final String name) {
            String n = translator.getClassMirrorTranslation(name);
            super.visitClassType(n);
        }
    };

    if (type) {
        r.acceptType(w);        
    } else {
        r.accept(w);        
    }
    return w.toString();
}
项目:asm-legacy-svn-clone    文件:CheckSignatureAdapterUnitTest.java   
public void checkSignature() {
    SignatureWriter wrt = new SignatureWriter();
    SignatureReader rdr = new SignatureReader(data.signature);
    switch (data.type) {
    case 'C':
        rdr.accept(new CheckSignatureAdapter(
                CheckSignatureAdapter.CLASS_SIGNATURE, wrt));
        break;
    case 'M':
        rdr.accept(new CheckSignatureAdapter(
                CheckSignatureAdapter.METHOD_SIGNATURE, wrt));
        break;
    case 'F':
        rdr.acceptType(new CheckSignatureAdapter(
                CheckSignatureAdapter.TYPE_SIGNATURE, wrt));
        break;
    default:
        return;
    }
    assertEquals(data.signature, wrt.toString());
}
项目:ow2-asm    文件:CheckSignatureAdapterUnitTest.java   
public void checkSignature() {
    SignatureWriter wrt = new SignatureWriter();
    SignatureReader rdr = new SignatureReader(data.signature);
    switch (data.type) {
    case 'C':
        rdr.accept(new CheckSignatureAdapter(
                CheckSignatureAdapter.CLASS_SIGNATURE, wrt));
        break;
    case 'M':
        rdr.accept(new CheckSignatureAdapter(
                CheckSignatureAdapter.METHOD_SIGNATURE, wrt));
        break;
    case 'F':
        rdr.acceptType(new CheckSignatureAdapter(
                CheckSignatureAdapter.TYPE_SIGNATURE, wrt));
        break;
    default:
        return;
    }
    assertEquals(data.signature, wrt.toString());
}
项目:objectweb-asm-4.0    文件:CheckSignatureAdapterUnitTest.java   
public void checkSignature() {
    SignatureWriter wrt = new SignatureWriter();
    SignatureReader rdr = new SignatureReader(data.signature);
    switch (data.type) {
        case 'C':
            rdr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.CLASS_SIGNATURE,
                    wrt));
            break;
        case 'M':
            rdr.accept(new CheckSignatureAdapter(CheckSignatureAdapter.METHOD_SIGNATURE,
                    wrt));
            break;
        case 'F':
            rdr.acceptType(new CheckSignatureAdapter(CheckSignatureAdapter.TYPE_SIGNATURE,
                    wrt));
            break;
        default:
            return;
    }
    assertEquals(data.signature, wrt.toString());
}
项目:jconts    文件:MethodContext.java   
/**
 * This method assumes that return type of the method is
 * <code>com.google.code.jconts.Computation&lt;T&gt;</code>. It extracts the type
 * argument <code>T</code> and returns it signature.
 */
private String valueSignature() {
    final SignatureWriter sign = new SignatureWriter();
    SignatureAdapter adaptor = new SignatureAdapter() {
        public SignatureVisitor visitReturnType() {
            return new SignatureAdapter() {
                @Override
                public SignatureVisitor visitTypeArgument(char wildcard) {
                    return sign;
                }

                // FIXME: All other are error!
            };
        };
    };
    new SignatureReader(signature).accept(adaptor);
    return sign.toString();
}
项目:jconts    文件:ContinuationClassGenerator.java   
public ContinuationClassGenerator(MethodContext info) {
    this.info = info;
    this.stateDesc = info.stateType.getDescriptor();

    SignatureWriter sign = new SignatureWriter();

    // Name<T> implements Continuation<T>
    sign.visitFormalTypeParameter("T");
    SignatureVisitor v = sign.visitClassBound();
    v.visitClassType(OBJECT_NAME);
    v.visitEnd();
    v = sign.visitSuperclass();
    v.visitClassType(OBJECT_NAME);
    v.visitEnd();
    v = sign.visitInterface();
    v.visitClassType(CONTINUATION_NAME);
    v.visitTypeArgument('=').visitTypeVariable("T");
    v.visitEnd();
    this.signature = sign.toString();
}
项目:DirectLeaks-AntiReleak-Remover    文件:Remapper.java   
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
项目:Spigot-Attribute-Remover    文件:Remapper.java   
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
项目:fastAOP    文件:Remapper.java   
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
项目:Book    文件:Mappings.java   
public String mapSignature(String signature, boolean isType, int api) {
    if (signature != null) {
        SignatureReader reader = new SignatureReader(signature);
        final SignatureWriter writer = new SignatureWriter();
        SignatureVisitor visitor = new BookSignatureVisitor(api, writer, this);
        if (isType) {
            reader.acceptType(visitor);
        } else {
            reader.accept(visitor);
        }
        return writer.toString();
    }
    return null;
}
项目:JReFrameworker    文件:Remapper.java   
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
项目:JReFrameworker    文件:Remapper.java   
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
项目:BitPlus    文件:Remapper.java   
/**
 * 
 * @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();
}
项目:Bramspr    文件:Remapper.java   
/**
 * 
 * @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();
}
项目:asm-legacy-svn-clone    文件:Remapper.java   
/**
 * @param signature
 *            signature for mapper
 * @param typeSignature
 *            true if signature is a FieldTypeSignature, such as the
 *            signature parameter of the ClassVisitor.visitField or
 *            MethodVisitor.visitLocalVariable methods
 * @return signature rewritten as a string
 */
public String mapSignature(String signature, boolean typeSignature) {
    if (signature == null) {
        return null;
    }
    SignatureReader r = new SignatureReader(signature);
    SignatureWriter w = new SignatureWriter();
    SignatureVisitor a = createSignatureRemapper(w);
    if (typeSignature) {
        r.acceptType(a);
    } else {
        r.accept(a);
    }
    return w.toString();
}
项目:bytecode-viewer    文件:Remapper.java   
/**
 * 
 * @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();
}
项目:libbluray    文件:Remapper.java   
/**
 * 
 * @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();
}
项目:byte-buddy    文件:FieldDescription.java   
@Override
public String getGenericSignature() {
    TypeDescription.Generic fieldType = getType();
    try {
        return fieldType.getSort().isNonGeneric()
                ? NON_GENERIC_SIGNATURE
                : fieldType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(new SignatureWriter())).toString();
    } catch (GenericSignatureFormatError ignored) {
        return NON_GENERIC_SIGNATURE;
    }
}
项目:byte-buddy    文件:MethodDescription.java   
@Override
public String getGenericSignature() {
    try {
        SignatureWriter signatureWriter = new SignatureWriter();
        boolean generic = false;
        for (TypeDescription.Generic typeVariable : getTypeVariables()) {
            signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol());
            boolean classBound = true;
            for (TypeDescription.Generic upperBound : typeVariable.getUpperBounds()) {
                upperBound.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(classBound
                        ? signatureWriter.visitClassBound()
                        : signatureWriter.visitInterfaceBound()));
                classBound = false;
            }
            generic = true;
        }
        for (TypeDescription.Generic parameterType : getParameters().asTypeList()) {
            parameterType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitParameterType()));
            generic = generic || !parameterType.getSort().isNonGeneric();
        }
        TypeDescription.Generic returnType = getReturnType();
        returnType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitReturnType()));
        generic = generic || !returnType.getSort().isNonGeneric();
        TypeList.Generic exceptionTypes = getExceptionTypes();
        if (!exceptionTypes.filter(not(ofSort(TypeDefinition.Sort.NON_GENERIC))).isEmpty()) {
            for (TypeDescription.Generic exceptionType : exceptionTypes) {
                exceptionType.accept(new TypeDescription.Generic.Visitor.ForSignatureVisitor(signatureWriter.visitExceptionType()));
                generic = generic || !exceptionType.getSort().isNonGeneric();
            }
        }
        return generic
                ? signatureWriter.toString()
                : NON_GENERIC_SIGNATURE;
    } catch (GenericSignatureFormatError ignored) {
        return NON_GENERIC_SIGNATURE;
    }
}
项目:byte-buddy    文件:TypeDescription.java   
@Override
public String getGenericSignature() {
    try {
        SignatureWriter signatureWriter = new SignatureWriter();
        boolean generic = false;
        for (Generic typeVariable : getTypeVariables()) {
            signatureWriter.visitFormalTypeParameter(typeVariable.getSymbol());
            for (Generic upperBound : typeVariable.getUpperBounds()) {
                upperBound.accept(new Generic.Visitor.ForSignatureVisitor(upperBound.asErasure().isInterface()
                        ? signatureWriter.visitInterfaceBound()
                        : signatureWriter.visitClassBound()));
            }
            generic = true;
        }
        Generic superClass = getSuperClass();
        // The object type itself is non generic and implicitly returns a non-generic signature
        if (superClass == null) {
            superClass = TypeDescription.Generic.OBJECT;
        }
        superClass.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitSuperclass()));
        generic = generic || !superClass.getSort().isNonGeneric();
        for (Generic interfaceType : getInterfaces()) {
            interfaceType.accept(new Generic.Visitor.ForSignatureVisitor(signatureWriter.visitInterface()));
            generic = generic || !interfaceType.getSort().isNonGeneric();
        }
        return generic
                ? signatureWriter.toString()
                : NON_GENERIC_SIGNATURE;
    } catch (GenericSignatureFormatError ignored) {
        return NON_GENERIC_SIGNATURE;
    }
}
项目:ow2-asm    文件:Remapper.java   
/**
 * 
 * @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();
}
项目:buck    文件:SourceAbiCompatibleVisitor.java   
private String fixupSignature(@PropagatesNullable String signature) {
  if (signature == null || compatibilityMode.usesDependencies()) {
    return signature;
  }

  SignatureReader reader = new SignatureReader(signature);
  SignatureWriter writer = new SignatureWriter();

  reader.accept(new SourceAbiCompatibleSignatureVisitor(writer));

  return writer.toString();
}
项目:buck    文件:SignatureFactory.java   
/**
 * 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;
}
项目:buck    文件:SignatureFactory.java   
@Nullable
public String getSignature(TypeMirror type) {
  SignatureWriter writer = new SignatureWriter();
  type.accept(typeVisitorAdapter, writer);
  String result = writer.toString();
  return result.isEmpty() ? null : result;
}
项目:buck    文件:SignatureFactoryTest.java   
/**
 * We can't tell whether an inferred class is a class, interface, annotation, or enum. This is
 * problematic for expressing generic type bounds, because the bytecode is different depending on
 * whether it is a class or an interface. As it happens, it's safe (from the compiler's
 * perspective) to treat everything as an interface. This method is used to rework the "expected"
 * signature so that we can use the same test data for testing with and without deps.
 */
private String treatDependencyBoundsAsInterfaces(String signature) {
  if (signature == null) {
    return null;
  }

  if (isTestingWithDependencies() || !signature.contains(":Lcom/facebook/foo/Dep")) {
    return signature;
  }

  SignatureWriter writer = new SignatureWriter();
  new SignatureReader(signature).accept(new SourceAbiCompatibleSignatureVisitor(writer));
  return writer.toString();
}
项目:objectweb-asm-4.0    文件:Remapper.java   
/**
 *
 * @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();
}
项目:jconts    文件:ComputationClassGenerator.java   
public void accept(TransformationContext context) {
    ClassVisitor cv = context.writer();

    // extends Object implements Computation<ValueType>
    SignatureWriter sign = new SignatureWriter();
    SignatureVisitor supsign = sign.visitSuperclass();
    supsign.visitClassType(OBJECT_NAME);
    supsign.visitEnd();
    SignatureVisitor iface = sign.visitInterface();
    iface.visitClassType(COMPUTATION_NAME);
    SignatureVisitor argsign = iface.visitTypeArgument('=');
    new SignatureReader(info.valueSignature).acceptType(argsign);
    argsign.visitEnd();

    cv.visit(Opcodes.V1_6, Opcodes.ACC_FINAL, info.computationClassName,
            sign.toString(), OBJECT_NAME, new String[] { COMPUTATION_NAME });

    cv.visitSource(info.ownerSource, null);
    cv.visitInnerClass(info.stateClassName, info.owner,
            info.stateSimpleName, 0);
    cv.visitInnerClass(info.computationClassName, info.owner,
            info.computationSimpleName, 0);

    cv.visitField(Opcodes.ACC_PRIVATE | Opcodes.ACC_FINAL, "state",
            stateDesc, null, null);

    generateConstructor(cv);
    generateExecute(cv);

    cv.visitEnd();
}
项目:jephyr    文件:RemappingClassAdapter.java   
private String mapSignature(String signature) {
    SignatureReader sr = new SignatureReader(signature);
    SignatureWriter sw = new SignatureWriter();
    sr.accept(new SignatureAdapter(sw));
    return sw.toString();
}
项目:jephyr    文件:RemappingClassAdapter.java   
private String mapTypeSignature(String signature) {
    SignatureReader sr = new SignatureReader(signature);
    SignatureWriter sw = new SignatureWriter();
    sr.acceptType(new SignatureAdapter(sw));
    return sw.toString();
}
项目:actorsguild    文件:GenericTypeHelper.java   
/**
 * Converts the given Type into a JVM signature. 
 * @param type the Type to analyze
 * @return the resulting signature
 */
public static String getSignature(java.lang.reflect.Type type) {
    SignatureWriter sw = new SignatureWriter();
    writeSignature(sw, type);
    return sw.toString();
}
项目:jconts    文件:ComputationClassGenerator.java   
private void generateExecute(ClassVisitor cv) {
    final String name = info.computationClassName;
    final Type outerType = Type.getObjectType(info.owner);

    // Generate execute(Continuation<T> cont);
    MethodVisitor mv = cv.visitMethod(Opcodes.ACC_FINAL
            | Opcodes.ACC_PUBLIC, COMPUTATION_EXECUTE_NAME,
            COMPUTATION_EXECUTE_DESC, executeSignature(), null);
    mv.visitCode();
    Label start = new Label();
    Label end = new Label();
    mv.visitLabel(start);

    // Load outer this
    if (!info.isStatic()) {
        mv.visitVarInsn(Opcodes.ALOAD, 0);
        mv.visitFieldInsn(Opcodes.GETFIELD, name, "this$0",
                outerType.getDescriptor());
    }

    // Load state field
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, name, "state", stateDesc);

    // state.continuation = continuation
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, name, "state", stateDesc);
    mv.visitVarInsn(Opcodes.ALOAD, 1);
    mv.visitFieldInsn(Opcodes.PUTFIELD, info.stateClassName,
            CONTINUATION_FIELD, CONTINUATION_DESC);

    // Initial state (0)
    mv.visitIntInsn(Opcodes.BIPUSH, 0);
    mv.visitMethodInsn(info.isStatic() ? Opcodes.INVOKESTATIC
            : Opcodes.INVOKEVIRTUAL, info.owner, info.name + "$async", Type
            .getMethodDescriptor(Type.VOID_TYPE, new Type[] {
                    info.stateType, Type.INT_TYPE }));

    mv.visitInsn(Opcodes.RETURN);
    mv.visitLabel(end);

    mv.visitLocalVariable("this", 'L' + name + ';', signature, start, end,
            0);
    if (!info.isStatic()) {
        mv.visitLocalVariable("this$0", outerType.getDescriptor(), null,
                start, end, 1);
    }

    SignatureWriter sign = new SignatureWriter();
    contSignature(sign);
    mv.visitLocalVariable("continuation", CONTINUATION_DESC,
            sign.toString(), start, end, 1 + info.thisOffset);

    mv.visitMaxs(3 + info.thisOffset, 2 + info.thisOffset);
    mv.visitEnd();
}
项目:jconts    文件:ComputationClassGenerator.java   
private String executeSignature() {
    SignatureWriter sw = new SignatureWriter();
    contSignature(sw.visitParameterType());
    sw.visitReturnType().visitBaseType('V');
    return sw.toString();
}
项目:jconts    文件:ContinuationClassGenerator.java   
private void generateExecute(ClassVisitor cv, boolean execute) {
    final String name = info.continuationClassName;
    final Type outerType = Type.getObjectType(info.owner);

    // Generate invoke(T result);
    String signature = null;
    if (execute) {
        SignatureWriter sign = new SignatureWriter();
        sign.visitParameterType().visitTypeVariable("T");
        sign.visitReturnType().visitBaseType('V'); // void
        signature = sign.toString();
    }
    MethodVisitor mv = cv.visitMethod(Opcodes.ACC_FINAL
            | Opcodes.ACC_PUBLIC, execute ? CONTINUATION_INVOKE_NAME
            : CONTINUATION_SET_EXCEPTION_NAME,
            execute ? CONTINUATION_INVOKE_DESC
                    : CONTINUATION_SET_EXCEPTION_DESC, signature, null);
    mv.visitCode();
    Label start = new Label();
    Label end = new Label();
    mv.visitLabel(start);

    // Load outer this
    if (!info.isStatic()) {
        mv.visitVarInsn(Opcodes.ALOAD, 0);
        mv.visitFieldInsn(Opcodes.GETFIELD, name, "this$0",
                outerType.getDescriptor());
    }

    // state.result = result or state.exception = throwable
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, name, "state", stateDesc);
    mv.visitVarInsn(Opcodes.ALOAD, 1);
    mv.visitFieldInsn(Opcodes.PUTFIELD, info.stateClassName,
            execute ? "result" : "exception", execute ? OBJECT_DESC
                    : THROWABLE_DESC);

    // Load state field
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, name, "state", stateDesc);

    // Continue from this index or index+1 (for exception)
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, name, "index", "I");
    if (!execute) {
        mv.visitInsn(Opcodes.ICONST_1);
        mv.visitInsn(Opcodes.IADD);
    }

    mv.visitMethodInsn(info.isStatic() ? Opcodes.INVOKESTATIC
            : Opcodes.INVOKEVIRTUAL, info.owner, info.name + "$async", Type
            .getMethodDescriptor(Type.VOID_TYPE, new Type[] {
                    info.stateType, Type.INT_TYPE }));

    mv.visitInsn(Opcodes.RETURN);
    mv.visitLabel(end);

    mv.visitLocalVariable("this", 'L' + name + ';', signature, start, end,
            0);
    if (!info.isStatic()) {
        mv.visitLocalVariable("this$0", outerType.getDescriptor(), null,
                start, end, 1);
    }
    mv.visitLocalVariable("result", OBJECT_DESC, "TT;", start, end,
            1 + info.thisOffset);

    mv.visitMaxs(3 + info.thisOffset + (execute ? 0 : 1),
            2 + info.thisOffset);
    mv.visitEnd();
}