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