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

Print this page




 130             if (newType != null && newTypes == null) {
 131                 newTypes = new String[types.length];
 132                 if (i > 0) {
 133                     System.arraycopy(types, 0, newTypes, 0, i);
 134                 }
 135                 needMapping = true;
 136             }
 137             if (needMapping) {
 138                 newTypes[i] = newType == null ? type : newType;
 139             }
 140         }
 141         return needMapping ? newTypes : types;
 142     }
 143 
 144     public String mapMethodDesc(String desc) {
 145         if ("()V".equals(desc)) {
 146             return desc;
 147         }
 148 
 149         Type[] args = Type.getArgumentTypes(desc);
 150         StringBuffer s = new StringBuffer("(");
 151         for (int i = 0; i < args.length; i++) {
 152             s.append(mapDesc(args[i].getDescriptor()));
 153         }
 154         Type returnType = Type.getReturnType(desc);
 155         if (returnType == Type.VOID_TYPE) {
 156             s.append(")V");
 157             return s.toString();
 158         }
 159         s.append(')').append(mapDesc(returnType.getDescriptor()));
 160         return s.toString();
 161     }
 162 
 163     public Object mapValue(Object value) {
 164         if (value instanceof Type) {
 165             return mapType((Type) value);
 166         }
 167         if (value instanceof Handle) {
 168             Handle h = (Handle) value;
 169             return new Handle(h.getTag(), mapType(h.getOwner()), mapMethodName(
 170                     h.getOwner(), h.getName(), h.getDesc()),
 171                     mapMethodDesc(h.getDesc()));
 172         }
 173         return value;
 174     }
 175 
 176     /**
 177      *
 178      * @param typeSignature
 179      *            true if signature is a FieldTypeSignature, such as the
 180      *            signature parameter of the ClassVisitor.visitField or




 130             if (newType != null && newTypes == null) {
 131                 newTypes = new String[types.length];
 132                 if (i > 0) {
 133                     System.arraycopy(types, 0, newTypes, 0, i);
 134                 }
 135                 needMapping = true;
 136             }
 137             if (needMapping) {
 138                 newTypes[i] = newType == null ? type : newType;
 139             }
 140         }
 141         return needMapping ? newTypes : types;
 142     }
 143 
 144     public String mapMethodDesc(String desc) {
 145         if ("()V".equals(desc)) {
 146             return desc;
 147         }
 148 
 149         Type[] args = Type.getArgumentTypes(desc);
 150         StringBuilder sb = new StringBuilder("(");
 151         for (int i = 0; i < args.length; i++) {
 152             sb.append(mapDesc(args[i].getDescriptor()));
 153         }
 154         Type returnType = Type.getReturnType(desc);
 155         if (returnType == Type.VOID_TYPE) {
 156             sb.append(")V");
 157             return sb.toString();
 158         }
 159         sb.append(')').append(mapDesc(returnType.getDescriptor()));
 160         return sb.toString();
 161     }
 162 
 163     public Object mapValue(Object value) {
 164         if (value instanceof Type) {
 165             return mapType((Type) value);
 166         }
 167         if (value instanceof Handle) {
 168             Handle h = (Handle) value;
 169             return new Handle(h.getTag(), mapType(h.getOwner()), mapMethodName(
 170                     h.getOwner(), h.getName(), h.getDesc()),
 171                     mapMethodDesc(h.getDesc()));
 172         }
 173         return value;
 174     }
 175 
 176     /**
 177      *
 178      * @param typeSignature
 179      *            true if signature is a FieldTypeSignature, such as the
 180      *            signature parameter of the ClassVisitor.visitField or