e35268
From df50f201a0f253bc55dc89e191ac66cb920a3274 Mon Sep 17 00:00:00 2001
e35268
From: Mat Booth <mat.booth@redhat.com>
e35268
Date: Wed, 6 May 2020 15:09:27 +0100
e35268
Subject: [PATCH] Revert upstream change 2a58bc9
e35268
e35268
---
e35268
 .../commons/RemappingAnnotationAdapter.java   |  85 ++++++
e35268
 .../asm/commons/RemappingClassAdapter.java    | 167 +++++++++++
e35268
 .../asm/commons/RemappingFieldAdapter.java    |  74 +++++
e35268
 .../asm/commons/RemappingMethodAdapter.java   | 279 ++++++++++++++++++
e35268
 .../commons/RemappingSignatureAdapter.java    | 157 ++++++++++
e35268
 5 files changed, 762 insertions(+)
e35268
 create mode 100644 asm-commons/src/main/java/org/objectweb/asm/commons/RemappingAnnotationAdapter.java
e35268
 create mode 100644 asm-commons/src/main/java/org/objectweb/asm/commons/RemappingClassAdapter.java
e35268
 create mode 100644 asm-commons/src/main/java/org/objectweb/asm/commons/RemappingFieldAdapter.java
e35268
 create mode 100644 asm-commons/src/main/java/org/objectweb/asm/commons/RemappingMethodAdapter.java
e35268
 create mode 100644 asm-commons/src/main/java/org/objectweb/asm/commons/RemappingSignatureAdapter.java
e35268
e35268
diff --git a/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingAnnotationAdapter.java b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingAnnotationAdapter.java
e35268
new file mode 100644
e35268
index 0000000..86c6ee9
e35268
--- /dev/null
e35268
+++ b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingAnnotationAdapter.java
e35268
@@ -0,0 +1,85 @@
e35268
+// ASM: a very small and fast Java bytecode manipulation framework
e35268
+// Copyright (c) 2000-2011 INRIA, France Telecom
e35268
+// All rights reserved.
e35268
+//
e35268
+// Redistribution and use in source and binary forms, with or without
e35268
+// modification, are permitted provided that the following conditions
e35268
+// are met:
e35268
+// 1. Redistributions of source code must retain the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer.
e35268
+// 2. Redistributions in binary form must reproduce the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer in the
e35268
+//    documentation and/or other materials provided with the distribution.
e35268
+// 3. Neither the name of the copyright holders nor the names of its
e35268
+//    contributors may be used to endorse or promote products derived from
e35268
+//    this software without specific prior written permission.
e35268
+//
e35268
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
e35268
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e35268
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
e35268
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
e35268
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
e35268
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
e35268
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
e35268
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
e35268
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
e35268
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
e35268
+// THE POSSIBILITY OF SUCH DAMAGE.
e35268
+
e35268
+package org.objectweb.asm.commons;
e35268
+
e35268
+import org.objectweb.asm.AnnotationVisitor;
e35268
+import org.objectweb.asm.Opcodes;
e35268
+
e35268
+/**
e35268
+ * An {@link AnnotationVisitor} adapter for type remapping.
e35268
+ *
e35268
+ * @deprecated use {@link AnnotationRemapper} instead.
e35268
+ * @author Eugene Kuleshov
e35268
+ */
e35268
+@Deprecated
e35268
+public class RemappingAnnotationAdapter extends AnnotationVisitor {
e35268
+
e35268
+  protected final Remapper remapper;
e35268
+
e35268
+  public RemappingAnnotationAdapter(
e35268
+      final AnnotationVisitor annotationVisitor, final Remapper remapper) {
e35268
+    this(Opcodes.ASM6, annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  protected RemappingAnnotationAdapter(
e35268
+      final int api, final AnnotationVisitor annotationVisitor, final Remapper remapper) {
e35268
+    super(api, annotationVisitor);
e35268
+    this.remapper = remapper;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visit(final String name, final Object value) {
e35268
+    av.visit(name, remapper.mapValue(value));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitEnum(final String name, final String descriptor, final String value) {
e35268
+    av.visitEnum(name, remapper.mapDesc(descriptor), value);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitAnnotation(final String name, final String descriptor) {
e35268
+    AnnotationVisitor annotationVisitor = av.visitAnnotation(name, remapper.mapDesc(descriptor));
e35268
+    return annotationVisitor == null
e35268
+        ? null
e35268
+        : (annotationVisitor == av
e35268
+            ? this
e35268
+            : new RemappingAnnotationAdapter(annotationVisitor, remapper));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitArray(final String name) {
e35268
+    AnnotationVisitor annotationVisitor = av.visitArray(name);
e35268
+    return annotationVisitor == null
e35268
+        ? null
e35268
+        : (annotationVisitor == av
e35268
+            ? this
e35268
+            : new RemappingAnnotationAdapter(annotationVisitor, remapper));
e35268
+  }
e35268
+}
e35268
diff --git a/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingClassAdapter.java b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingClassAdapter.java
e35268
new file mode 100644
e35268
index 0000000..b4cc08c
e35268
--- /dev/null
e35268
+++ b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingClassAdapter.java
e35268
@@ -0,0 +1,167 @@
e35268
+// ASM: a very small and fast Java bytecode manipulation framework
e35268
+// Copyright (c) 2000-2011 INRIA, France Telecom
e35268
+// All rights reserved.
e35268
+//
e35268
+// Redistribution and use in source and binary forms, with or without
e35268
+// modification, are permitted provided that the following conditions
e35268
+// are met:
e35268
+// 1. Redistributions of source code must retain the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer.
e35268
+// 2. Redistributions in binary form must reproduce the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer in the
e35268
+//    documentation and/or other materials provided with the distribution.
e35268
+// 3. Neither the name of the copyright holders nor the names of its
e35268
+//    contributors may be used to endorse or promote products derived from
e35268
+//    this software without specific prior written permission.
e35268
+//
e35268
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
e35268
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e35268
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
e35268
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
e35268
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
e35268
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
e35268
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
e35268
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
e35268
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
e35268
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
e35268
+// THE POSSIBILITY OF SUCH DAMAGE.
e35268
+
e35268
+package org.objectweb.asm.commons;
e35268
+
e35268
+import org.objectweb.asm.AnnotationVisitor;
e35268
+import org.objectweb.asm.ClassVisitor;
e35268
+import org.objectweb.asm.FieldVisitor;
e35268
+import org.objectweb.asm.MethodVisitor;
e35268
+import org.objectweb.asm.ModuleVisitor;
e35268
+import org.objectweb.asm.Opcodes;
e35268
+import org.objectweb.asm.TypePath;
e35268
+
e35268
+/**
e35268
+ * A {@link ClassVisitor} for type remapping.
e35268
+ *
e35268
+ * @deprecated use {@link ClassRemapper} instead.
e35268
+ * @author Eugene Kuleshov
e35268
+ */
e35268
+@Deprecated
e35268
+public class RemappingClassAdapter extends ClassVisitor {
e35268
+
e35268
+  protected final Remapper remapper;
e35268
+
e35268
+  protected String className;
e35268
+
e35268
+  public RemappingClassAdapter(final ClassVisitor classVisitor, final Remapper remapper) {
e35268
+    this(Opcodes.ASM6, classVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  protected RemappingClassAdapter(
e35268
+      final int api, final ClassVisitor classVisitor, final Remapper remapper) {
e35268
+    super(api, classVisitor);
e35268
+    this.remapper = remapper;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visit(
e35268
+      final int version,
e35268
+      final int access,
e35268
+      final String name,
e35268
+      final String signature,
e35268
+      final String superName,
e35268
+      final String[] interfaces) {
e35268
+    this.className = name;
e35268
+    super.visit(
e35268
+        version,
e35268
+        access,
e35268
+        remapper.mapType(name),
e35268
+        remapper.mapSignature(signature, false),
e35268
+        remapper.mapType(superName),
e35268
+        interfaces == null ? null : remapper.mapTypes(interfaces));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public ModuleVisitor visitModule(final String name, final int flags, final String version) {
e35268
+    throw new RuntimeException("RemappingClassAdapter is deprecated, use ClassRemapper instead");
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitAnnotation(remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null ? null : createRemappingAnnotationAdapter(annotationVisitor);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitTypeAnnotation(
e35268
+      final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null ? null : createRemappingAnnotationAdapter(annotationVisitor);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public FieldVisitor visitField(
e35268
+      final int access,
e35268
+      final String name,
e35268
+      final String descriptor,
e35268
+      final String signature,
e35268
+      final Object value) {
e35268
+    FieldVisitor fieldVisitor =
e35268
+        super.visitField(
e35268
+            access,
e35268
+            remapper.mapFieldName(className, name, descriptor),
e35268
+            remapper.mapDesc(descriptor),
e35268
+            remapper.mapSignature(signature, true),
e35268
+            remapper.mapValue(value));
e35268
+    return fieldVisitor == null ? null : createRemappingFieldAdapter(fieldVisitor);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public MethodVisitor visitMethod(
e35268
+      final int access,
e35268
+      final String name,
e35268
+      final String descriptor,
e35268
+      final String signature,
e35268
+      final String[] exceptions) {
e35268
+    String newDescriptor = remapper.mapMethodDesc(descriptor);
e35268
+    MethodVisitor methodVisitor =
e35268
+        super.visitMethod(
e35268
+            access,
e35268
+            remapper.mapMethodName(className, name, descriptor),
e35268
+            newDescriptor,
e35268
+            remapper.mapSignature(signature, false),
e35268
+            exceptions == null ? null : remapper.mapTypes(exceptions));
e35268
+    return methodVisitor == null
e35268
+        ? null
e35268
+        : createRemappingMethodAdapter(access, newDescriptor, methodVisitor);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitInnerClass(
e35268
+      final String name, final String outerName, final String innerName, final int access) {
e35268
+    super.visitInnerClass(
e35268
+        remapper.mapType(name),
e35268
+        outerName == null ? null : remapper.mapType(outerName),
e35268
+        innerName,
e35268
+        access);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitOuterClass(final String owner, final String name, final String descriptor) {
e35268
+    super.visitOuterClass(
e35268
+        remapper.mapType(owner),
e35268
+        name == null ? null : remapper.mapMethodName(owner, name, descriptor),
e35268
+        descriptor == null ? null : remapper.mapMethodDesc(descriptor));
e35268
+  }
e35268
+
e35268
+  protected FieldVisitor createRemappingFieldAdapter(final FieldVisitor fieldVisitor) {
e35268
+    return new RemappingFieldAdapter(fieldVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  protected MethodVisitor createRemappingMethodAdapter(
e35268
+      final int access, final String newDescriptor, final MethodVisitor methodVisitior) {
e35268
+    return new RemappingMethodAdapter(access, newDescriptor, methodVisitior, remapper);
e35268
+  }
e35268
+
e35268
+  protected AnnotationVisitor createRemappingAnnotationAdapter(final AnnotationVisitor av) {
e35268
+    return new RemappingAnnotationAdapter(av, remapper);
e35268
+  }
e35268
+}
e35268
diff --git a/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingFieldAdapter.java b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingFieldAdapter.java
e35268
new file mode 100644
e35268
index 0000000..5f14f33
e35268
--- /dev/null
e35268
+++ b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingFieldAdapter.java
e35268
@@ -0,0 +1,74 @@
e35268
+// ASM: a very small and fast Java bytecode manipulation framework
e35268
+// Copyright (c) 2000-2011 INRIA, France Telecom
e35268
+// All rights reserved.
e35268
+//
e35268
+// Redistribution and use in source and binary forms, with or without
e35268
+// modification, are permitted provided that the following conditions
e35268
+// are met:
e35268
+// 1. Redistributions of source code must retain the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer.
e35268
+// 2. Redistributions in binary form must reproduce the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer in the
e35268
+//    documentation and/or other materials provided with the distribution.
e35268
+// 3. Neither the name of the copyright holders nor the names of its
e35268
+//    contributors may be used to endorse or promote products derived from
e35268
+//    this software without specific prior written permission.
e35268
+//
e35268
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
e35268
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e35268
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
e35268
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
e35268
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
e35268
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
e35268
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
e35268
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
e35268
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
e35268
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
e35268
+// THE POSSIBILITY OF SUCH DAMAGE.
e35268
+
e35268
+package org.objectweb.asm.commons;
e35268
+
e35268
+import org.objectweb.asm.AnnotationVisitor;
e35268
+import org.objectweb.asm.FieldVisitor;
e35268
+import org.objectweb.asm.Opcodes;
e35268
+import org.objectweb.asm.TypePath;
e35268
+
e35268
+/**
e35268
+ * A {@link FieldVisitor} adapter for type remapping.
e35268
+ *
e35268
+ * @deprecated use {@link FieldRemapper} instead.
e35268
+ * @author Eugene Kuleshov
e35268
+ */
e35268
+@Deprecated
e35268
+public class RemappingFieldAdapter extends FieldVisitor {
e35268
+
e35268
+  private final Remapper remapper;
e35268
+
e35268
+  public RemappingFieldAdapter(final FieldVisitor fieldVisitor, final Remapper remapper) {
e35268
+    this(Opcodes.ASM6, fieldVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  protected RemappingFieldAdapter(
e35268
+      final int api, final FieldVisitor fieldVisitor, final Remapper remapper) {
e35268
+    super(api, fieldVisitor);
e35268
+    this.remapper = remapper;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor = fv.visitAnnotation(remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? null
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitTypeAnnotation(
e35268
+      final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? null
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+}
e35268
diff --git a/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingMethodAdapter.java b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingMethodAdapter.java
e35268
new file mode 100644
e35268
index 0000000..cf21f18
e35268
--- /dev/null
e35268
+++ b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingMethodAdapter.java
e35268
@@ -0,0 +1,279 @@
e35268
+// ASM: a very small and fast Java bytecode manipulation framework
e35268
+// Copyright (c) 2000-2011 INRIA, France Telecom
e35268
+// All rights reserved.
e35268
+//
e35268
+// Redistribution and use in source and binary forms, with or without
e35268
+// modification, are permitted provided that the following conditions
e35268
+// are met:
e35268
+// 1. Redistributions of source code must retain the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer.
e35268
+// 2. Redistributions in binary form must reproduce the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer in the
e35268
+//    documentation and/or other materials provided with the distribution.
e35268
+// 3. Neither the name of the copyright holders nor the names of its
e35268
+//    contributors may be used to endorse or promote products derived from
e35268
+//    this software without specific prior written permission.
e35268
+//
e35268
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
e35268
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e35268
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
e35268
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
e35268
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
e35268
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
e35268
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
e35268
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
e35268
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
e35268
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
e35268
+// THE POSSIBILITY OF SUCH DAMAGE.
e35268
+
e35268
+package org.objectweb.asm.commons;
e35268
+
e35268
+import org.objectweb.asm.AnnotationVisitor;
e35268
+import org.objectweb.asm.Handle;
e35268
+import org.objectweb.asm.Label;
e35268
+import org.objectweb.asm.MethodVisitor;
e35268
+import org.objectweb.asm.Opcodes;
e35268
+import org.objectweb.asm.TypePath;
e35268
+
e35268
+/**
e35268
+ * A {@link LocalVariablesSorter} for type mapping.
e35268
+ *
e35268
+ * @deprecated use {@link MethodRemapper} instead.
e35268
+ * @author Eugene Kuleshov
e35268
+ */
e35268
+@Deprecated
e35268
+public class RemappingMethodAdapter extends LocalVariablesSorter {
e35268
+
e35268
+  protected final Remapper remapper;
e35268
+
e35268
+  public RemappingMethodAdapter(
e35268
+      final int access,
e35268
+      final String descriptor,
e35268
+      final MethodVisitor methodVisitor,
e35268
+      final Remapper remapper) {
e35268
+    this(Opcodes.ASM6, access, descriptor, methodVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  protected RemappingMethodAdapter(
e35268
+      final int api,
e35268
+      final int access,
e35268
+      final String descriptor,
e35268
+      final MethodVisitor methodVisitor,
e35268
+      final Remapper remapper) {
e35268
+    super(api, access, descriptor, methodVisitor);
e35268
+    this.remapper = remapper;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitAnnotationDefault() {
e35268
+    AnnotationVisitor annotationVisitor = super.visitAnnotationDefault();
e35268
+    return annotationVisitor == null
e35268
+        ? annotationVisitor
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitAnnotation(final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitAnnotation(remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? annotationVisitor
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitTypeAnnotation(
e35268
+      final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitTypeAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? annotationVisitor
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitParameterAnnotation(
e35268
+      final int parameter, final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitParameterAnnotation(parameter, remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? annotationVisitor
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitFrame(
e35268
+      final int type,
e35268
+      final int numLocal,
e35268
+      final Object[] local,
e35268
+      final int numStack,
e35268
+      final Object[] stack) {
e35268
+    super.visitFrame(
e35268
+        type, numLocal, remapEntries(numLocal, local), numStack, remapEntries(numStack, stack));
e35268
+  }
e35268
+
e35268
+  private Object[] remapEntries(final int numTypes, final Object[] entries) {
e35268
+    if (entries == null) {
e35268
+      return entries;
e35268
+    }
e35268
+    Object[] remappedEntries = null;
e35268
+    for (int i = 0; i < numTypes; ++i) {
e35268
+      if (entries[i] instanceof String) {
e35268
+        if (remappedEntries == null) {
e35268
+          remappedEntries = new Object[numTypes];
e35268
+          System.arraycopy(entries, 0, remappedEntries, 0, numTypes);
e35268
+        }
e35268
+        remappedEntries[i] = remapper.mapType((String) entries[i]);
e35268
+      }
e35268
+    }
e35268
+    return remappedEntries == null ? entries : remappedEntries;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitFieldInsn(
e35268
+      final int opcode, final String owner, final String name, final String descriptor) {
e35268
+    super.visitFieldInsn(
e35268
+        opcode,
e35268
+        remapper.mapType(owner),
e35268
+        remapper.mapFieldName(owner, name, descriptor),
e35268
+        remapper.mapDesc(descriptor));
e35268
+  }
e35268
+
e35268
+  @Deprecated
e35268
+  @Override
e35268
+  public void visitMethodInsn(
e35268
+      final int opcode, final String owner, final String name, final String descriptor) {
e35268
+    if (api >= Opcodes.ASM5) {
e35268
+      super.visitMethodInsn(opcode, owner, name, descriptor);
e35268
+      return;
e35268
+    }
e35268
+    doVisitMethodInsn(opcode, owner, name, descriptor, opcode == Opcodes.INVOKEINTERFACE);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitMethodInsn(
e35268
+      final int opcode,
e35268
+      final String owner,
e35268
+      final String name,
e35268
+      final String descriptor,
e35268
+      final boolean isInterface) {
e35268
+    if (api < Opcodes.ASM5) {
e35268
+      super.visitMethodInsn(opcode, owner, name, descriptor, isInterface);
e35268
+      return;
e35268
+    }
e35268
+    doVisitMethodInsn(opcode, owner, name, descriptor, isInterface);
e35268
+  }
e35268
+
e35268
+  private void doVisitMethodInsn(
e35268
+      final int opcode,
e35268
+      final String owner,
e35268
+      final String name,
e35268
+      final String descriptor,
e35268
+      final boolean isInterface) {
e35268
+    // Calling super.visitMethodInsn requires to call the correct version
e35268
+    // depending on this.api (otherwise infinite loops can occur). To
e35268
+    // simplify and to make it easier to automatically remove the backward
e35268
+    // compatibility code, we inline the code of the overridden method here.
e35268
+    // IMPORTANT: THIS ASSUMES THAT visitMethodInsn IS NOT OVERRIDDEN IN
e35268
+    // LocalVariableSorter.
e35268
+    if (mv != null) {
e35268
+      mv.visitMethodInsn(
e35268
+          opcode,
e35268
+          remapper.mapType(owner),
e35268
+          remapper.mapMethodName(owner, name, descriptor),
e35268
+          remapper.mapMethodDesc(descriptor),
e35268
+          isInterface);
e35268
+    }
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitInvokeDynamicInsn(
e35268
+      final String name,
e35268
+      final String descriptor,
e35268
+      final Handle bootstrapMethodHandle,
e35268
+      final Object... bootstrapMethodArguments) {
e35268
+    for (int i = 0; i < bootstrapMethodArguments.length; i++) {
e35268
+      bootstrapMethodArguments[i] = remapper.mapValue(bootstrapMethodArguments[i]);
e35268
+    }
e35268
+    super.visitInvokeDynamicInsn(
e35268
+        remapper.mapInvokeDynamicMethodName(name, descriptor),
e35268
+        remapper.mapMethodDesc(descriptor),
e35268
+        (Handle) remapper.mapValue(bootstrapMethodHandle),
e35268
+        bootstrapMethodArguments);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitTypeInsn(final int opcode, final String type) {
e35268
+    super.visitTypeInsn(opcode, remapper.mapType(type));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitLdcInsn(final Object value) {
e35268
+    super.visitLdcInsn(remapper.mapValue(value));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitMultiANewArrayInsn(final String descriptor, final int numDimensions) {
e35268
+    super.visitMultiANewArrayInsn(remapper.mapDesc(descriptor), numDimensions);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitInsnAnnotation(
e35268
+      final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? annotationVisitor
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitTryCatchBlock(
e35268
+      final Label start, final Label end, final Label handler, final String type) {
e35268
+    super.visitTryCatchBlock(start, end, handler, type == null ? null : remapper.mapType(type));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitTryCatchAnnotation(
e35268
+      final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitTryCatchAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? annotationVisitor
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitLocalVariable(
e35268
+      final String name,
e35268
+      final String descriptor,
e35268
+      final String signature,
e35268
+      final Label start,
e35268
+      final Label end,
e35268
+      final int index) {
e35268
+    super.visitLocalVariable(
e35268
+        name,
e35268
+        remapper.mapDesc(descriptor),
e35268
+        remapper.mapSignature(signature, true),
e35268
+        start,
e35268
+        end,
e35268
+        index);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public AnnotationVisitor visitLocalVariableAnnotation(
e35268
+      final int typeRef,
e35268
+      final TypePath typePath,
e35268
+      final Label[] start,
e35268
+      final Label[] end,
e35268
+      final int[] index,
e35268
+      final String descriptor,
e35268
+      final boolean visible) {
e35268
+    AnnotationVisitor annotationVisitor =
e35268
+        super.visitLocalVariableAnnotation(
e35268
+            typeRef, typePath, start, end, index, remapper.mapDesc(descriptor), visible);
e35268
+    return annotationVisitor == null
e35268
+        ? annotationVisitor
e35268
+        : new RemappingAnnotationAdapter(annotationVisitor, remapper);
e35268
+  }
e35268
+}
e35268
diff --git a/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingSignatureAdapter.java b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingSignatureAdapter.java
e35268
new file mode 100644
e35268
index 0000000..1553cd5
e35268
--- /dev/null
e35268
+++ b/asm-commons/src/main/java/org/objectweb/asm/commons/RemappingSignatureAdapter.java
e35268
@@ -0,0 +1,157 @@
e35268
+// ASM: a very small and fast Java bytecode manipulation framework
e35268
+// Copyright (c) 2000-2011 INRIA, France Telecom
e35268
+// All rights reserved.
e35268
+//
e35268
+// Redistribution and use in source and binary forms, with or without
e35268
+// modification, are permitted provided that the following conditions
e35268
+// are met:
e35268
+// 1. Redistributions of source code must retain the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer.
e35268
+// 2. Redistributions in binary form must reproduce the above copyright
e35268
+//    notice, this list of conditions and the following disclaimer in the
e35268
+//    documentation and/or other materials provided with the distribution.
e35268
+// 3. Neither the name of the copyright holders nor the names of its
e35268
+//    contributors may be used to endorse or promote products derived from
e35268
+//    this software without specific prior written permission.
e35268
+//
e35268
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
e35268
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
e35268
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
e35268
+// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
e35268
+// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
e35268
+// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
e35268
+// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
e35268
+// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
e35268
+// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
e35268
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
e35268
+// THE POSSIBILITY OF SUCH DAMAGE.
e35268
+
e35268
+package org.objectweb.asm.commons;
e35268
+
e35268
+import org.objectweb.asm.Opcodes;
e35268
+import org.objectweb.asm.signature.SignatureVisitor;
e35268
+
e35268
+/**
e35268
+ * A {@link SignatureVisitor} adapter for type mapping.
e35268
+ *
e35268
+ * @deprecated use {@link SignatureRemapper} instead.
e35268
+ * @author Eugene Kuleshov
e35268
+ */
e35268
+@Deprecated
e35268
+public class RemappingSignatureAdapter extends SignatureVisitor {
e35268
+
e35268
+  private final SignatureVisitor signatureVisitor;
e35268
+
e35268
+  private final Remapper remapper;
e35268
+
e35268
+  private String className;
e35268
+
e35268
+  public RemappingSignatureAdapter(
e35268
+      final SignatureVisitor signatureVisitor, final Remapper remapper) {
e35268
+    this(Opcodes.ASM6, signatureVisitor, remapper);
e35268
+  }
e35268
+
e35268
+  protected RemappingSignatureAdapter(
e35268
+      final int api, final SignatureVisitor signatureVisitor, final Remapper remapper) {
e35268
+    super(api);
e35268
+    this.signatureVisitor = signatureVisitor;
e35268
+    this.remapper = remapper;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitClassType(final String name) {
e35268
+    className = name;
e35268
+    signatureVisitor.visitClassType(remapper.mapType(name));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitInnerClassType(final String name) {
e35268
+    String remappedOuter = remapper.mapType(className) + '$';
e35268
+    className = className + '$' + name;
e35268
+    String remappedName = remapper.mapType(className);
e35268
+    int index =
e35268
+        remappedName.startsWith(remappedOuter)
e35268
+            ? remappedOuter.length()
e35268
+            : remappedName.lastIndexOf('$') + 1;
e35268
+    signatureVisitor.visitInnerClassType(remappedName.substring(index));
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitFormalTypeParameter(final String name) {
e35268
+    signatureVisitor.visitFormalTypeParameter(name);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitTypeVariable(final String name) {
e35268
+    signatureVisitor.visitTypeVariable(name);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitArrayType() {
e35268
+    signatureVisitor.visitArrayType();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitBaseType(final char descriptor) {
e35268
+    signatureVisitor.visitBaseType(descriptor);
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitClassBound() {
e35268
+    signatureVisitor.visitClassBound();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitExceptionType() {
e35268
+    signatureVisitor.visitExceptionType();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitInterface() {
e35268
+    signatureVisitor.visitInterface();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitInterfaceBound() {
e35268
+    signatureVisitor.visitInterfaceBound();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitParameterType() {
e35268
+    signatureVisitor.visitParameterType();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitReturnType() {
e35268
+    signatureVisitor.visitReturnType();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitSuperclass() {
e35268
+    signatureVisitor.visitSuperclass();
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitTypeArgument() {
e35268
+    signatureVisitor.visitTypeArgument();
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public SignatureVisitor visitTypeArgument(final char wildcard) {
e35268
+    signatureVisitor.visitTypeArgument(wildcard);
e35268
+    return this;
e35268
+  }
e35268
+
e35268
+  @Override
e35268
+  public void visitEnd() {
e35268
+    signatureVisitor.visitEnd();
e35268
+  }
e35268
+}
e35268
-- 
e35268
2.26.0
e35268