Class TypeWriter.Default.ForInlining.WithFullProcessing.RedefinitionClassVisitor

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void onAfterAttributes()
      Invoked if the attribute visitation is about to complete.
      protected void onNestHost()
      Invoked if the nest host was not visited.
      protected void onOuterType()
      Invoked if the outer class was not visited.
      protected org.objectweb.asm.AnnotationVisitor onVisitAnnotation​(java.lang.String descriptor, boolean visible)
      An order-sensitive invocation of ClassVisitor.visitAnnotation(String, boolean).
      protected void onVisitEnd()
      An order-sensitive invocation of ClassVisitor.visitEnd().
      protected org.objectweb.asm.FieldVisitor onVisitField​(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String genericSignature, java.lang.Object defaultValue)
      An order-sensitive invocation of ClassVisitor.visitField(int, String, String, String, Object).
      protected void onVisitInnerClass​(java.lang.String internalName, java.lang.String outerName, java.lang.String innerName, int modifiers)
      An order-sensitive invocation of ClassVisitor.visitInnerClass(String, String, String, int).
      protected org.objectweb.asm.MethodVisitor onVisitMethod​(int modifiers, java.lang.String internalName, java.lang.String descriptor, java.lang.String genericSignature, java.lang.String[] exceptionName)
      An order-sensitive invocation of ClassVisitor.visitMethod(int, String, String, String, String[]).
      protected void onVisitNestHost​(java.lang.String nestHost)
      An order-sensitive invocation of ClassVisitor.visitNestHost(String).
      protected void onVisitNestMember​(java.lang.String nestMember)
      An order-sensitive invocation of ClassVisitor.visitNestMember(String).
      protected void onVisitOuterClass​(java.lang.String owner, java.lang.String name, java.lang.String descriptor)
      An order-sensitive invocation of ClassVisitor.visitOuterClass(String, String, String).
      protected org.objectweb.asm.AnnotationVisitor onVisitTypeAnnotation​(int typeReference, org.objectweb.asm.TypePath typePath, java.lang.String descriptor, boolean visible)
      An order-sensitive invocation of ClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean).
      protected org.objectweb.asm.MethodVisitor redefine​(MethodDescription methodDescription, boolean abstractOrigin, int modifiers, java.lang.String genericSignature)
      Redefines a given method if this is required by looking up a potential implementation from the TypeWriter.MethodPool.
      protected org.objectweb.asm.FieldVisitor redefine​(TypeWriter.FieldPool.Record record, java.lang.Object defaultValue, int modifiers, java.lang.String genericSignature)
      Redefines a field using the given explicit field pool record and default value.
      private int resolveDeprecationModifiers​(int modifiers)
      Returns Opcodes.ACC_DEPRECATED if the current class file version only represents deprecated methods using modifiers that are not exposed in the type description API what is true for class files before Java 5 and if the supplied modifiers indicate deprecation.
      void visit​(int classFileVersionNumber, int modifiers, java.lang.String internalName, java.lang.String genericSignature, java.lang.String superClassInternalName, java.lang.String[] interfaceTypeInternalName)  
      • Methods inherited from class org.objectweb.asm.ClassVisitor

        visitModule, visitPermittedSubtypeExperimental, visitRecordComponentExperimental, visitSource
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • typeInitializer

        private final TypeInitializer typeInitializer
        The type initializer to apply.
      • writerFlags

        private final int writerFlags
        The writer flags being used.
      • readerFlags

        private final int readerFlags
        The reader flags being used.
      • declarableFields

        private final java.util.LinkedHashMap<java.lang.String,​FieldDescription> declarableFields
        A mapping of fields to write by their names.
      • declarableMethods

        private final java.util.LinkedHashMap<java.lang.String,​MethodDescription> declarableMethods
        A mapping of methods to write by a concatenation of internal name and descriptor.
      • nestMembers

        private final java.util.Set<java.lang.String> nestMembers
        A set of internal names of all nest members not yet defined by this type. If this type is not a nest host, this set is empty.
      • declaredTypes

        private final java.util.LinkedHashMap<java.lang.String,​TypeDescription> declaredTypes
        A mapping of the internal names of all declared types to their description.
      • methodPool

        private TypeWriter.MethodPool methodPool
        The method pool to use or null if the pool was not yet initialized.
      • retainDeprecationModifiers

        private boolean retainDeprecationModifiers
        true if the modifiers for deprecation should be retained.
    • Constructor Detail

      • RedefinitionClassVisitor

        protected RedefinitionClassVisitor​(org.objectweb.asm.ClassVisitor classVisitor,
                                           TypeInitializer typeInitializer,
                                           TypeWriter.Default.ForInlining.ContextRegistry contextRegistry,
                                           int writerFlags,
                                           int readerFlags)
        Creates a class visitor which is capable of redefining an existent class on the fly.
        Parameters:
        classVisitor - The underlying class visitor to which writes are delegated.
        typeInitializer - The type initializer to apply.
        contextRegistry - A context registry to register the lazily created implementation context to.
        writerFlags - The writer flags being used.
        readerFlags - The reader flags being used.
    • Method Detail

      • visit

        public void visit​(int classFileVersionNumber,
                          int modifiers,
                          java.lang.String internalName,
                          java.lang.String genericSignature,
                          java.lang.String superClassInternalName,
                          java.lang.String[] interfaceTypeInternalName)
        Overrides:
        visit in class org.objectweb.asm.ClassVisitor
      • onVisitNestHost

        protected void onVisitNestHost​(java.lang.String nestHost)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitNestHost(String).
        Overrides:
        onVisitNestHost in class MetadataAwareClassVisitor
        Parameters:
        nestHost - The internal name of the nest host.
      • onVisitOuterClass

        protected void onVisitOuterClass​(java.lang.String owner,
                                         java.lang.String name,
                                         java.lang.String descriptor)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitOuterClass(String, String, String).
        Overrides:
        onVisitOuterClass in class MetadataAwareClassVisitor
        Parameters:
        owner - The outer class's internal name.
        name - The outer method's name or null if it does not exist.
        descriptor - The outer method's descriptor or null if it does not exist.
      • onVisitTypeAnnotation

        protected org.objectweb.asm.AnnotationVisitor onVisitTypeAnnotation​(int typeReference,
                                                                            org.objectweb.asm.TypePath typePath,
                                                                            java.lang.String descriptor,
                                                                            boolean visible)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitTypeAnnotation(int, TypePath, String, boolean).
        Overrides:
        onVisitTypeAnnotation in class MetadataAwareClassVisitor
        Parameters:
        typeReference - The type reference of the type annotation.
        typePath - The type path of the type annotation.
        descriptor - The descriptor of the annotation type.
        visible - true if the annotation is visible at runtime.
        Returns:
        An annotation visitor or null if the annotation should be ignored.
      • onVisitAnnotation

        protected org.objectweb.asm.AnnotationVisitor onVisitAnnotation​(java.lang.String descriptor,
                                                                        boolean visible)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitAnnotation(String, boolean).
        Overrides:
        onVisitAnnotation in class MetadataAwareClassVisitor
        Parameters:
        descriptor - The annotation type's descriptor.
        visible - true if the annotation is visible at runtime.
        Returns:
        An annotation visitor or null if the annotation should be ignored.
      • onVisitField

        protected org.objectweb.asm.FieldVisitor onVisitField​(int modifiers,
                                                              java.lang.String internalName,
                                                              java.lang.String descriptor,
                                                              java.lang.String genericSignature,
                                                              java.lang.Object defaultValue)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitField(int, String, String, String, Object).
        Overrides:
        onVisitField in class MetadataAwareClassVisitor
        Parameters:
        modifiers - The field's modifiers.
        internalName - The field's internal name.
        descriptor - The field type's descriptor.
        genericSignature - The field's generic signature or null if the field is not generic.
        defaultValue - The field's default value or null if no such value exists.
        Returns:
        A field visitor to visit the field or null to ignore it.
      • redefine

        protected org.objectweb.asm.FieldVisitor redefine​(TypeWriter.FieldPool.Record record,
                                                          java.lang.Object defaultValue,
                                                          int modifiers,
                                                          java.lang.String genericSignature)
        Redefines a field using the given explicit field pool record and default value.
        Parameters:
        record - The field pool value to apply during visitation of the existing field.
        defaultValue - The default value to write onto the field which might be null.
        modifiers - The original modifiers of the transformed field.
        genericSignature - The field's original generic signature which can be null.
        Returns:
        A field visitor for visiting the existing field definition.
      • onVisitMethod

        protected org.objectweb.asm.MethodVisitor onVisitMethod​(int modifiers,
                                                                java.lang.String internalName,
                                                                java.lang.String descriptor,
                                                                java.lang.String genericSignature,
                                                                java.lang.String[] exceptionName)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitMethod(int, String, String, String, String[]).
        Overrides:
        onVisitMethod in class MetadataAwareClassVisitor
        Parameters:
        modifiers - The method's modifiers.
        internalName - The method's internal name.
        descriptor - The field type's descriptor.
        genericSignature - The method's generic signature or null if the method is not generic.
        exceptionName - The method's declared exceptions or null if no exceptions are declared.
        Returns:
        A method visitor to visit the method or null to ignore it.
      • redefine

        protected org.objectweb.asm.MethodVisitor redefine​(MethodDescription methodDescription,
                                                           boolean abstractOrigin,
                                                           int modifiers,
                                                           java.lang.String genericSignature)
        Redefines a given method if this is required by looking up a potential implementation from the TypeWriter.MethodPool.
        Parameters:
        methodDescription - The method being considered for redefinition.
        abstractOrigin - true if the original method is abstract, i.e. there is no implementation to preserve.
        modifiers - The original modifiers of the transformed method.
        genericSignature - The method's original generic signature which can be null.
        Returns:
        A method visitor which is capable of consuming the original method.
      • onVisitInnerClass

        protected void onVisitInnerClass​(java.lang.String internalName,
                                         java.lang.String outerName,
                                         java.lang.String innerName,
                                         int modifiers)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitInnerClass(String, String, String, int).
        Overrides:
        onVisitInnerClass in class MetadataAwareClassVisitor
        Parameters:
        internalName - The internal name of the inner class.
        outerName - The internal name of the outer class.
        innerName - The inner class's simple name or null for an anonymous class.
        modifiers - The inner class's source code modifiers.
      • onVisitNestMember

        protected void onVisitNestMember​(java.lang.String nestMember)
        Description copied from class: MetadataAwareClassVisitor
        An order-sensitive invocation of ClassVisitor.visitNestMember(String).
        Overrides:
        onVisitNestMember in class MetadataAwareClassVisitor
        Parameters:
        nestMember - The internal name of the nest member.
      • resolveDeprecationModifiers

        private int resolveDeprecationModifiers​(int modifiers)
        Returns Opcodes.ACC_DEPRECATED if the current class file version only represents deprecated methods using modifiers that are not exposed in the type description API what is true for class files before Java 5 and if the supplied modifiers indicate deprecation.
        Parameters:
        modifiers - The original modifiers.
        Returns:
        Opcodes.ACC_DEPRECATED if the supplied modifiers imply deprecation.