Example usage for org.objectweb.asm Opcodes ASM4

List of usage examples for org.objectweb.asm Opcodes ASM4

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes ASM4.

Prototype

int ASM4

To view the source code for org.objectweb.asm Opcodes ASM4.

Click Source Link

Usage

From source file:org.apache.sling.metrics.impl.MetricsClassVisitor.java

License:Apache License

public MetricsClassVisitor(@Nonnull ClassVisitor cv, @Nonnull String className, @Nonnull String[] ancestors,
        @Nonnull DropwizardMetricsConfig metricsConfig, @Nonnull LogServiceHolder logServiceHolder) {
    super(Opcodes.ASM4, cv);
    this.className = className;
    this.ancestors = ancestors;
    this.metricsConfig = metricsConfig;
    this.logServiceHolder = logServiceHolder;
    logServiceHolder.debug("Visiting class ", className, " ", Arrays.toString(ancestors));
}

From source file:org.apache.sling.metrics.impl.ReturnAdapter.java

License:Apache License

public ReturnAdapter(@Nonnull MethodVisitor mv, int access, @Nonnull String name, @Nonnull String desc,
        @Nonnull String timerName, @Nullable String keyMethodName, @Nullable String helperClassName,
        boolean mark) {
    super(Opcodes.ASM4, mv, access, name, desc);
    this.helperClassName = helperClassName;
    this.keyMethodName = keyMethodName;
    this.timerName = name;
    this.mark = mark;
}

From source file:org.apache.sling.metrics.impl.TimerAdapter.java

License:Apache License

public TimerAdapter(@Nonnull MethodVisitor mv, int access, @Nonnull String name, @Nonnull String descriptor,
        @Nonnull String timerName) {
    super(Opcodes.ASM4, mv, access, name, descriptor);
    this.timerName = timerName;
}

From source file:org.apache.sling.metrics.impl.VoidAdapter.java

License:Apache License

public VoidAdapter(@Nonnull MethodVisitor mv, int access, @Nonnull String name, @Nonnull String descriptor,
        @Nonnull String timerName, @Nonnull String method) {
    super(Opcodes.ASM4, mv, access, name, descriptor);
    this.timerName = timerName;
    this.method = method;
}

From source file:org.apache.tika.parser.asm.XHTMLClassVisitor.java

License:Apache License

public XHTMLClassVisitor(ContentHandler handler, Metadata metadata) {
    super(Opcodes.ASM4);
    this.xhtml = new XHTMLContentHandler(handler, metadata);
    this.metadata = metadata;
}

From source file:org.conqat.engine.java.fingerprinting.HashingMethodVisitor.java

License:Apache License

/**
 * Constructor./*  w  ww . j a va  2 s. co  m*/
 * 
 * @param node
 *            the node to add the fingerprint to (using key
 *            {@link MethodFingerPrinter#FINGERPRINT_KEY}).
 */
public HashingMethodVisitor(StringSetNode node, boolean debug) {
    super(Opcodes.ASM4);
    this.node = node;
    if (debug) {
        debugBuilder = new StringBuilder();
    } else {
        debugBuilder = null;
    }
}

From source file:org.copperengine.core.instrument.ScottyClassAdapter.java

License:Apache License

@Override
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
    if (interruptableMethods.contains(name + desc) && ((access & ACC_ABSTRACT) == 0)) {
        logger.debug("Transforming {}.{}{}", new Object[] { currentClassName, name, desc });
        MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions);

        String classDesc = Type.getObjectType(currentClassName).getDescriptor();
        BuildStackInfoAdapter stackInfo = new BuildStackInfoAdapter(classDesc, (access & ACC_STATIC) > 0, name,
                desc, signature);/*from  w w  w.  ja  v  a  2s  .  c  om*/
        final ScottyMethodAdapter scotty = new ScottyMethodAdapter(mv, currentClassName, interruptableMethods,
                stackInfo, name, access, desc);
        MethodVisitor collectMethodInfo = new MethodVisitor(Opcodes.ASM4, stackInfo) {
            @Override
            public void visitEnd() {
                super.visitEnd();
                methodInfos.add(scotty.getMethodInfo());
            }
        };
        stackInfo.setMethodVisitor(scotty);
        // ScottyMethodAdapter stackInfo = new ScottyMethodAdapter(mv, currentClassName, interruptableMethods);
        return collectMethodInfo;
    }
    return super.visitMethod(access, name, desc, signature, exceptions);
}

From source file:org.eclipse.andmore.internal.resources.manager.ProjectClassLoader.java

License:Open Source License

/**
 * Rewrites the given class to the given target class file version.
 *//*from  w  w w.j a  va2 s .  com*/
public static byte[] rewriteClass(byte[] classData, final int maxVersion, final int minVersion) {
    assert maxVersion >= minVersion;
    ClassWriter classWriter = new ClassWriter(0);
    ClassVisitor classVisitor = new ClassVisitor(Opcodes.ASM4, classWriter) {
        @Override
        public void visit(int version, int access, String name, String signature, String superName,
                String[] interfaces) {
            if (version > maxVersion) {
                version = maxVersion;
            }
            if (version < minVersion) {
                version = minVersion;
            }
            super.visit(version, access, name, signature, superName, interfaces);
        }
    };
    ClassReader reader = new ClassReader(classData);
    reader.accept(classVisitor, 0);
    return classWriter.toByteArray();
}

From source file:org.evosuite.instrumentation.CreateClassResetClassAdapter.java

License:Open Source License

/**
 * <p>//  www  . j  a va 2s.  c o m
 * Constructor for StaticInitializationClassAdapter.
 * </p>
 * 
 * @param visitor
 *            a {@link org.objectweb.asm.ClassVisitor} object.
 * @param className
 *            a {@link java.lang.String} object.
 */
public CreateClassResetClassAdapter(ClassVisitor visitor, String className) {
    super(Opcodes.ASM4, visitor);
    this.className = className;
}

From source file:org.evosuite.instrumentation.ErrorConditionClassAdapter.java

License:Open Source License

/**
 * <p>//from w w w.java  2 s.  c  o  m
 * Constructor for ErrorConditionClassAdapter.
 * </p>
 * 
 * @param cv
 *            a {@link org.objectweb.asm.ClassVisitor} object.
 * @param className
 *            a {@link java.lang.String} object.
 */
public ErrorConditionClassAdapter(ClassVisitor cv, String className) {
    super(Opcodes.ASM4, cv);
    this.className = className;
}