< prev index next >

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

Print this page




  72  * <ul>
  73  * <li>{@link #map(String)} - map type</li>
  74  * <li>{@link #mapFieldName(String, String, String)} - map field name</li>
  75  * <li>{@link #mapMethodName(String, String, String)} - map method name</li>
  76  * </ul>
  77  *
  78  * @author Eugene Kuleshov
  79  */
  80 public abstract class Remapper {
  81 
  82     public String mapDesc(String desc) {
  83         Type t = Type.getType(desc);
  84         switch (t.getSort()) {
  85         case Type.ARRAY:
  86             String s = mapDesc(t.getElementType().getDescriptor());
  87             for (int i = 0; i < t.getDimensions(); ++i) {
  88                 s = '[' + s;
  89             }
  90             return s;
  91         case Type.OBJECT:

  92             String newType = map(t.getInternalName());
  93             if (newType != null) {
  94                 return 'L' + newType + ';';
  95             }
  96         }
  97         return desc;
  98     }
  99 
 100     private Type mapType(Type t) {
 101         switch (t.getSort()) {
 102         case Type.ARRAY:
 103             String s = mapDesc(t.getElementType().getDescriptor());
 104             for (int i = 0; i < t.getDimensions(); ++i) {
 105                 s = '[' + s;
 106             }
 107             return Type.getType(s);
 108         case Type.OBJECT:
 109             s = map(t.getInternalName());
 110             return s != null ? Type.getObjectType(s) : t;
 111         case Type.METHOD:




  72  * <ul>
  73  * <li>{@link #map(String)} - map type</li>
  74  * <li>{@link #mapFieldName(String, String, String)} - map field name</li>
  75  * <li>{@link #mapMethodName(String, String, String)} - map method name</li>
  76  * </ul>
  77  *
  78  * @author Eugene Kuleshov
  79  */
  80 public abstract class Remapper {
  81 
  82     public String mapDesc(String desc) {
  83         Type t = Type.getType(desc);
  84         switch (t.getSort()) {
  85         case Type.ARRAY:
  86             String s = mapDesc(t.getElementType().getDescriptor());
  87             for (int i = 0; i < t.getDimensions(); ++i) {
  88                 s = '[' + s;
  89             }
  90             return s;
  91         case Type.OBJECT:
  92             // FIXME: support Q-type
  93             String newType = map(t.getInternalName());
  94             if (newType != null) {
  95                 return 'L' + newType + ';';
  96             }
  97         }
  98         return desc;
  99     }
 100 
 101     private Type mapType(Type t) {
 102         switch (t.getSort()) {
 103         case Type.ARRAY:
 104             String s = mapDesc(t.getElementType().getDescriptor());
 105             for (int i = 0; i < t.getDimensions(); ++i) {
 106                 s = '[' + s;
 107             }
 108             return Type.getType(s);
 109         case Type.OBJECT:
 110             s = map(t.getInternalName());
 111             return s != null ? Type.getObjectType(s) : t;
 112         case Type.METHOD:


< prev index next >