< prev index next >

src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/RemappingClassAdapter.java

Print this page
rev 47452 : imported patch jdk-new-asmv6.patch


  46  *
  47  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  48  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  49  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  50  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  51  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  52  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  53  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  54  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  55  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  56  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  57  * THE POSSIBILITY OF SUCH DAMAGE.
  58  */
  59 
  60 package jdk.internal.org.objectweb.asm.commons;
  61 
  62 import jdk.internal.org.objectweb.asm.AnnotationVisitor;
  63 import jdk.internal.org.objectweb.asm.ClassVisitor;
  64 import jdk.internal.org.objectweb.asm.FieldVisitor;
  65 import jdk.internal.org.objectweb.asm.MethodVisitor;

  66 import jdk.internal.org.objectweb.asm.Opcodes;
  67 import jdk.internal.org.objectweb.asm.TypePath;
  68 
  69 /**
  70  * A {@link ClassVisitor} for type remapping.
  71  *
  72  * @deprecated use {@link ClassRemapper} instead.
  73  * @author Eugene Kuleshov
  74  */
  75 @Deprecated
  76 public class RemappingClassAdapter extends ClassVisitor {
  77 
  78     protected final Remapper remapper;
  79 
  80     protected String className;
  81 
  82     public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) {
  83         this(Opcodes.ASM5, cv, remapper);
  84     }
  85 
  86     protected RemappingClassAdapter(final int api, final ClassVisitor cv,
  87             final Remapper remapper) {
  88         super(api, cv);
  89         this.remapper = remapper;
  90     }
  91 
  92     @Override
  93     public void visit(int version, int access, String name, String signature,
  94             String superName, String[] interfaces) {
  95         this.className = name;
  96         super.visit(version, access, remapper.mapType(name), remapper
  97                 .mapSignature(signature, false), remapper.mapType(superName),
  98                 interfaces == null ? null : remapper.mapTypes(interfaces));
  99     }
 100 





 101     @Override
 102     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
 103         AnnotationVisitor av = super.visitAnnotation(remapper.mapDesc(desc),
 104                 visible);
 105         return av == null ? null : createRemappingAnnotationAdapter(av);
 106     }
 107 
 108     @Override
 109     public AnnotationVisitor visitTypeAnnotation(int typeRef,
 110             TypePath typePath, String desc, boolean visible) {
 111         AnnotationVisitor av = super.visitTypeAnnotation(typeRef, typePath,
 112                 remapper.mapDesc(desc), visible);
 113         return av == null ? null : createRemappingAnnotationAdapter(av);
 114     }
 115 
 116     @Override
 117     public FieldVisitor visitField(int access, String name, String desc,
 118             String signature, Object value) {
 119         FieldVisitor fv = super.visitField(access,
 120                 remapper.mapFieldName(className, name, desc),




  46  *
  47  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  48  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  49  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  50  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  51  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  52  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  53  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  54  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  55  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  56  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  57  * THE POSSIBILITY OF SUCH DAMAGE.
  58  */
  59 
  60 package jdk.internal.org.objectweb.asm.commons;
  61 
  62 import jdk.internal.org.objectweb.asm.AnnotationVisitor;
  63 import jdk.internal.org.objectweb.asm.ClassVisitor;
  64 import jdk.internal.org.objectweb.asm.FieldVisitor;
  65 import jdk.internal.org.objectweb.asm.MethodVisitor;
  66 import jdk.internal.org.objectweb.asm.ModuleVisitor;
  67 import jdk.internal.org.objectweb.asm.Opcodes;
  68 import jdk.internal.org.objectweb.asm.TypePath;
  69 
  70 /**
  71  * A {@link ClassVisitor} for type remapping.
  72  *
  73  * @deprecated use {@link ClassRemapper} instead.
  74  * @author Eugene Kuleshov
  75  */
  76 @Deprecated
  77 public class RemappingClassAdapter extends ClassVisitor {
  78 
  79     protected final Remapper remapper;
  80 
  81     protected String className;
  82 
  83     public RemappingClassAdapter(final ClassVisitor cv, final Remapper remapper) {
  84         this(Opcodes.ASM6, cv, remapper);
  85     }
  86 
  87     protected RemappingClassAdapter(final int api, final ClassVisitor cv,
  88             final Remapper remapper) {
  89         super(api, cv);
  90         this.remapper = remapper;
  91     }
  92 
  93     @Override
  94     public void visit(int version, int access, String name, String signature,
  95             String superName, String[] interfaces) {
  96         this.className = name;
  97         super.visit(version, access, remapper.mapType(name), remapper
  98                 .mapSignature(signature, false), remapper.mapType(superName),
  99                 interfaces == null ? null : remapper.mapTypes(interfaces));
 100     }
 101 
 102     @Override
 103     public ModuleVisitor visitModule(String name, int flags, String version) {
 104         throw new RuntimeException("RemappingClassAdapter is deprecated, use ClassRemapper instead");
 105     }
 106 
 107     @Override
 108     public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
 109         AnnotationVisitor av = super.visitAnnotation(remapper.mapDesc(desc),
 110                 visible);
 111         return av == null ? null : createRemappingAnnotationAdapter(av);
 112     }
 113 
 114     @Override
 115     public AnnotationVisitor visitTypeAnnotation(int typeRef,
 116             TypePath typePath, String desc, boolean visible) {
 117         AnnotationVisitor av = super.visitTypeAnnotation(typeRef, typePath,
 118                 remapper.mapDesc(desc), visible);
 119         return av == null ? null : createRemappingAnnotationAdapter(av);
 120     }
 121 
 122     @Override
 123     public FieldVisitor visitField(int access, String name, String desc,
 124             String signature, Object value) {
 125         FieldVisitor fv = super.visitField(access,
 126                 remapper.mapFieldName(className, name, desc),


< prev index next >