Example usage for com.google.gwt.dev.asm Opcodes ACC_PUBLIC

List of usage examples for com.google.gwt.dev.asm Opcodes ACC_PUBLIC

Introduction

In this page you can find the example usage for com.google.gwt.dev.asm Opcodes ACC_PUBLIC.

Prototype

int ACC_PUBLIC

To view the source code for com.google.gwt.dev.asm Opcodes ACC_PUBLIC.

Click Source Link

Usage

From source file:com.googlecode.gwt.test.internal.rewrite.RewriteSingleJsoImplDispatches.java

License:Apache License

private void writeEmptyMethod(String mangledMethodName, Method declMethod) {
    MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_ABSTRACT, mangledMethodName,
            declMethod.getDescriptor(), null, null);
    mv.visitEnd();/*from  ww w.j a v  a 2 s . c om*/
}

From source file:com.googlecode.gwt.test.internal.rewrite.RewriteSingleJsoImplDispatches.java

License:Apache License

/**
 * For regular Java objects that implement a SingleJsoImpl interface, write instance trampoline
 * dispatchers for mangled method names to the implementing method.
 *///  ww  w.ja  v a  2s  .  c o m
private void writeTrampoline(String stubIntr) {
    /*
     * This is almost the same kind of trampoline as the ones generated in WriteJsoImpl, however
     * there are enough small differences between the semantics of the dispatches that would make
     * a common implementation far more awkward than the duplication of code.
     */
    for (String mangledName : toImplement(stubIntr)) {
        for (Method method : jsoData.getDeclarations(mangledName)) {

            Method toCall = new Method(method.getName(), method.getDescriptor());

            // Must not be final
            MethodVisitor mv = super.visitMethod(Opcodes.ACC_PUBLIC | Opcodes.ACC_SYNTHETIC, mangledName,
                    method.getDescriptor(), null, null);
            if (mv != null) {
                mv.visitCode();

                /*
                 * It just so happens that the stack and local variable sizes are the same, but
                 * they're kept distinct to aid in clarity should the dispatch logic change.
                 * 
                 * These start at 1 because we need to load "this" onto the stack
                 */
                int var = 1;
                int size = 1;

                // load this
                mv.visitVarInsn(Opcodes.ALOAD, 0);

                // then the rest of the arguments
                for (Type t : toCall.getArgumentTypes()) {
                    size += t.getSize();
                    mv.visitVarInsn(t.getOpcode(Opcodes.ILOAD), var);
                    var += t.getSize();
                }

                // Make sure there's enough room for the return value
                size = Math.max(size, toCall.getReturnType().getSize());

                mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, currentTypeName, toCall.getName(),
                        toCall.getDescriptor());
                mv.visitInsn(toCall.getReturnType().getOpcode(Opcodes.IRETURN));
                mv.visitMaxs(size, var);
                mv.visitEnd();
            }
        }
    }
}

From source file:com.googlecode.gwt.test.internal.rewrite.WriteJsoImpl.java

License:Apache License

/**
 * Records the original name and resets access opcodes.
 *///from   w  w w  .ja va  2s .co  m
@Override
public void visit(int version, int access, String name, String signature, String superName,
        String[] interfaces) {
    originalName = name;
    super.visit(version, Opcodes.ACC_PUBLIC | Opcodes.ACC_STATIC | Opcodes.ACC_SYNTHETIC, name + '$', signature,
            superName, interfaces);
}