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