All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mockit.external.asm.WrappingClassVisitor Maven / Gradle / Ivy

Go to download

JMockit is a Java toolkit for automated developer testing. It contains APIs for the creation of the objects to be tested, for mocking dependencies, and for faking external APIs; JUnit (4 & 5) and TestNG test runners are supported. It also contains an advanced code coverage tool.

There is a newer version: 1.49
Show newest version
package mockit.external.asm;

import javax.annotation.*;

/**
 * Same as {@link ClassVisitor}, except it always wraps a {@link ClassWriter}.
 */
public class WrappingClassVisitor extends ClassVisitor
{
   /**
    * The class visitor to which this visitor must delegate method calls.
    */
   @Nonnull protected final ClassWriter cw;

   /**
    * Constructs a new {@link WrappingClassVisitor}.
    *
    * @param cw the class writer to which this visitor must delegate method calls.
    */
   protected WrappingClassVisitor(@Nonnull ClassWriter cw) { this.cw = cw; }

   @Override
   public void visit(
      int version, int access, @Nonnull String name, @Nullable String signature, @Nullable String superName,
      @Nullable String[] interfaces
   ) {
      cw.visit(version, access, name, signature, superName, interfaces);
   }

   @Override
   public void visitSource(@Nullable String source, @Nullable String debug) {
      cw.visitSource(source, debug);
   }

   @Override
   public void visitOuterClass(@Nonnull String owner, @Nullable String name, @Nullable String desc) {
      cw.visitOuterClass(owner, name, desc);
   }

   @Nullable @Override
   public AnnotationVisitor visitAnnotation(@Nonnull String desc) {
      return cw.visitAnnotation(desc);
   }

   @Override
   public void visitInnerClass(
      @Nonnull String name, @Nullable String outerName, @Nullable String innerName, int access
   ) {
      cw.visitInnerClass(name, outerName, innerName, access);
   }

   @Nullable @Override
   public FieldVisitor visitField(
      int access, @Nonnull String name, @Nonnull String desc, @Nullable String signature, @Nullable Object value
   ) {
      return cw.visitField(access, name, desc, signature, value);
   }

   @Override
   public MethodVisitor visitMethod(
      int access, @Nonnull String name, @Nonnull String desc, @Nullable String signature, @Nullable String[] exceptions
   ) {
      return cw.visitMethod(access, name, desc, signature, exceptions);
   }

   @Override
   public void visitEnd() {
      cw.visitEnd();
   }

   @Override
   public final byte[] toByteArray() { return cw.toByteArray(); }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy