Class InnerClassAccessStripper

java.lang.Object
org.objectweb.asm.ClassVisitor
org.apache.drill.exec.compile.InnerClassAccessStripper

public class InnerClassAccessStripper extends org.objectweb.asm.ClassVisitor
An ASM ClassVisitor that strips class the access bits that are only possible on inner classes (ACC_PROTECTED, ACC_PRIVATE, and ACC_FINAL). These bits are only stripped from the class' visit() call if the class' name contains a '$'.

This visitor is meant to be used on classes that will undergo validation with CheckClassAdapter. CheckClassAdapter assumes it will only be called on non-inner classes, and throws an IllegalArgumentException if the class is protected, private, or final. However, once classes are compiled, they appear in their class files alone, and these options may be present, with no way for an outside observer to tell if they were originally inner classes.

  • Field Summary

    Fields inherited from class org.objectweb.asm.ClassVisitor

    api, cv
  • Constructor Summary

    Constructors
    Constructor
    Description
    See ClassVisitor(int).
    InnerClassAccessStripper(int api, org.objectweb.asm.ClassVisitor cv)
    See ClassVisitor(int, ClassVisitor).
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Return the original class' access bits.
    void
    visit(int version, int access, String name, String signature, String superName, String[] interfaces)
     

    Methods inherited from class org.objectweb.asm.ClassVisitor

    getDelegate, visitAnnotation, visitAttribute, visitEnd, visitField, visitInnerClass, visitMethod, visitModule, visitNestHost, visitNestMember, visitOuterClass, visitPermittedSubclass, visitRecordComponent, visitSource, visitTypeAnnotation

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • InnerClassAccessStripper

      public InnerClassAccessStripper(int api)
      See ClassVisitor(int).
    • InnerClassAccessStripper

      public InnerClassAccessStripper(int api, org.objectweb.asm.ClassVisitor cv)
      See ClassVisitor(int, ClassVisitor).
  • Method Details

    • getOriginalAccess

      public int getOriginalAccess()
      Return the original class' access bits.

      This may only be called after ClassVisitor.visit(int, int, String, String, String, String[]) has been called; that's where the bits are stripped and captured.

      Returns:
      the original class bits
      Throws:
      IllegalStateException - if visit() hasn't been called yet
    • visit

      public void visit(int version, int access, String name, String signature, String superName, String[] interfaces)
      Overrides:
      visit in class org.objectweb.asm.ClassVisitor