@Override public AnnotationVisitor visitAnnotation(String desc, boolean visible) { AnnotationVisitor av = super.visitAnnotation(desc, visible); if (SpringReqMapASM.springRequestMappingAnnotations.contains(desc)) { if (!desc.endsWith("RequestMapping;")) { String pkg = "web/bind/annotation/"; String postfix = "Mapping;"; int index = desc.indexOf(pkg); if (index > -1) { int startIndex = index + pkg.length(); index = desc.lastIndexOf(postfix); if (index > startIndex) { int lastIndex = index; this.methodType = desc.substring(startIndex, lastIndex).toUpperCase(); } } } return new SpringReqMapMVAV(av); } return av; }
break; int local = newLocalMapping(type); setLocalType(local, type); setFrameLocal(local, t); return local;
System.arraycopy(remappedLocalTypes, 0, oldRemappedLocals, 0, oldRemappedLocals.length); updateNewLocals(remappedLocalTypes); varType = Type.getObjectType((String) localType); setFrameLocal(remap(oldVar, varType), localType);
@Override public void visitVarInsn(final int opcode, final int var) { Type type; switch (opcode) { case Opcodes.LLOAD: case Opcodes.LSTORE: type = Type.LONG_TYPE; break; case Opcodes.DLOAD: case Opcodes.DSTORE: type = Type.DOUBLE_TYPE; break; case Opcodes.FLOAD: case Opcodes.FSTORE: type = Type.FLOAT_TYPE; break; case Opcodes.ILOAD: case Opcodes.ISTORE: type = Type.INT_TYPE; break; default: // case Opcodes.ALOAD: // case Opcodes.ASTORE: // case RET: type = OBJECT_TYPE; break; } mv.visitVarInsn(opcode, remap(var, type)); }
private int remap(final int var, final Type type) { if (var + type.getSize() <= firstLocal) { return var; } int key = 2 * var + type.getSize() - 1; int size = remappedVariableIndices.length; if (key >= size) { int[] newRemappedVariableIndices = new int[Math.max(2 * size, key + 1)]; System.arraycopy(remappedVariableIndices, 0, newRemappedVariableIndices, 0, size); remappedVariableIndices = newRemappedVariableIndices; } int value = remappedVariableIndices[key]; if (value == 0) { value = newLocalMapping(type); setLocalType(value, type); remappedVariableIndices[key] = value + 1; } else { value--; } return value; }
@Override public void visitFieldInsn( final int opcode, final String owner, final String name, final String descriptor) { super.visitFieldInsn( opcode, remapper.mapType(owner), remapper.mapFieldName(owner, name, descriptor), remapper.mapDesc(descriptor)); }
@Override public void visitFrame( final int type, final int numLocal, final Object[] local, final int numStack, final Object[] stack) { super.visitFrame( type, numLocal, remapEntries(numLocal, local), numStack, remapEntries(numStack, stack)); }
@Override public AnnotationVisitor visitInsnAnnotation( final int typeRef, final TypePath typePath, final String descriptor, final boolean visible) { AnnotationVisitor annotationVisitor = super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(descriptor), visible); return annotationVisitor == null ? annotationVisitor : new RemappingAnnotationAdapter(annotationVisitor, remapper); }
@Override public AnnotationVisitor visitAnnotationDefault() { AnnotationVisitor annotationVisitor = super.visitAnnotationDefault(); return annotationVisitor == null ? annotationVisitor : new RemappingAnnotationAdapter(annotationVisitor, remapper); }
throw new AssertionError(); int local = newLocalMapping(type); setLocalType(local, type); setFrameLocal(local, localType); return local;
System.arraycopy(remappedLocalTypes, 0, oldRemappedLocals, 0, oldRemappedLocals.length); updateNewLocals(remappedLocalTypes); varType = Type.getObjectType((String) localType); setFrameLocal(remap(oldVar, varType), localType);
@Override public void visitLocalVariable( final String name, final String descriptor, final String signature, final Label start, final Label end, final int index) { int remappedIndex = remap(index, Type.getType(descriptor)); super.visitLocalVariable(name, descriptor, signature, start, end, remappedIndex); }
private int remap(final int var, final Type type) { if (var + type.getSize() <= firstLocal) { return var; } int key = 2 * var + type.getSize() - 1; int size = remappedVariableIndices.length; if (key >= size) { int[] newRemappedVariableIndices = new int[Math.max(2 * size, key + 1)]; System.arraycopy(remappedVariableIndices, 0, newRemappedVariableIndices, 0, size); remappedVariableIndices = newRemappedVariableIndices; } int value = remappedVariableIndices[key]; if (value == 0) { value = newLocalMapping(type); setLocalType(value, type); remappedVariableIndices[key] = value + 1; } else { value--; } return value; }
@Override public void visitFieldInsn(int opcode, String owner, String name, String desc) { super.visitFieldInsn(opcode, remapper.mapType(owner), remapper.mapFieldName(owner, name, desc), remapper.mapDesc(desc)); }
@Override public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { super.visitFrame(type, nLocal, remapEntries(nLocal, local), nStack, remapEntries(nStack, stack)); }
@Override public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { AnnotationVisitor av = super.visitInsnAnnotation(typeRef, typePath, remapper.mapDesc(desc), visible); return av == null ? av : new RemappingAnnotationAdapter(av, remapper); }
@Override public AnnotationVisitor visitAnnotationDefault() { AnnotationVisitor av = super.visitAnnotationDefault(); return av == null ? av : new RemappingAnnotationAdapter(av, remapper); }
throw new AssertionError(); int local = newLocalMapping(type); setLocalType(local, type); setFrameLocal(local, localType); return local;
System.arraycopy(newLocals, 0, oldLocals, 0, oldLocals.length); updateNewLocals(newLocals); typ = Type.getObjectType((String) t); setFrameLocal(remap(index, typ), t);
@Override public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, int[] index, String desc, boolean visible) { Type t = Type.getType(desc); int[] newIndex = new int[index.length]; for (int i = 0; i < newIndex.length; ++i) { newIndex[i] = remap(index[i], t); } return mv.visitLocalVariableAnnotation(typeRef, typePath, start, end, newIndex, desc, visible); }