diff --git a/today-core/src/main/java/cn/taketoday/bytecode/transform/AnnotationVisitorTee.java b/today-core/src/main/java/cn/taketoday/bytecode/transform/AnnotationVisitorTee.java deleted file mode 100644 index e920620374..0000000000 --- a/today-core/src/main/java/cn/taketoday/bytecode/transform/AnnotationVisitorTee.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] - */ -package cn.taketoday.bytecode.transform; - -import cn.taketoday.bytecode.AnnotationVisitor; - -public class AnnotationVisitorTee extends AnnotationVisitor { - private final AnnotationVisitor av1; - private final AnnotationVisitor av2; - - public static AnnotationVisitor getInstance(AnnotationVisitor av1, AnnotationVisitor av2) { - if (av1 == null) - return av2; - if (av2 == null) - return av1; - return new AnnotationVisitorTee(av1, av2); - } - - public AnnotationVisitorTee(AnnotationVisitor av1, AnnotationVisitor av2) { - super(); - this.av1 = av1; - this.av2 = av2; - } - - public void visit(String name, Object value) { - av2.visit(name, value); - av2.visit(name, value); - } - - public void visitEnum(String name, String desc, String value) { - av1.visitEnum(name, desc, value); - av2.visitEnum(name, desc, value); - } - - public AnnotationVisitor visitAnnotation(String name, String desc) { - return getInstance(av1.visitAnnotation(name, desc), av2.visitAnnotation(name, desc)); - } - - public AnnotationVisitor visitArray(String name) { - return getInstance(av1.visitArray(name), av2.visitArray(name)); - } - - public void visitEnd() { - av1.visitEnd(); - av2.visitEnd(); - } -} diff --git a/today-core/src/main/java/cn/taketoday/bytecode/transform/ClassTransformerTee.java b/today-core/src/main/java/cn/taketoday/bytecode/transform/ClassTransformerTee.java deleted file mode 100644 index ed40744351..0000000000 --- a/today-core/src/main/java/cn/taketoday/bytecode/transform/ClassTransformerTee.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] - */ -package cn.taketoday.bytecode.transform; - -import cn.taketoday.bytecode.ClassVisitor; - -public class ClassTransformerTee extends ClassTransformer { - - private final ClassVisitor branch; - - public ClassTransformerTee(ClassVisitor branch) { -// super(Constant.ASM_API); - this.branch = branch; - } - - public void setTarget(ClassVisitor target) { - cv = new ClassVisitorTee(branch, target); - } -} diff --git a/today-core/src/main/java/cn/taketoday/bytecode/transform/ClassVisitorTee.java b/today-core/src/main/java/cn/taketoday/bytecode/transform/ClassVisitorTee.java deleted file mode 100644 index dfbd0a9ac7..0000000000 --- a/today-core/src/main/java/cn/taketoday/bytecode/transform/ClassVisitorTee.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] - */ -package cn.taketoday.bytecode.transform; - -import cn.taketoday.bytecode.AnnotationVisitor; -import cn.taketoday.bytecode.Attribute; -import cn.taketoday.bytecode.ClassVisitor; -import cn.taketoday.bytecode.FieldVisitor; -import cn.taketoday.bytecode.MethodVisitor; -import cn.taketoday.bytecode.TypePath; - -public class ClassVisitorTee extends ClassVisitor { - - private ClassVisitor cv1, cv2; - - public ClassVisitorTee(ClassVisitor cv1, ClassVisitor cv2) { -// super(Constant.ASM_API); - this.cv1 = cv1; - this.cv2 = cv2; - } - - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - cv1.visit(version, access, name, signature, superName, interfaces); - cv2.visit(version, access, name, signature, superName, interfaces); - } - - public void visitEnd() { - cv1.visitEnd(); - cv2.visitEnd(); - cv1 = cv2 = null; - } - - public void visitInnerClass(String name, String outerName, String innerName, int access) { - cv1.visitInnerClass(name, outerName, innerName, access); - cv2.visitInnerClass(name, outerName, innerName, access); - } - - public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - FieldVisitor fv1 = cv1.visitField(access, name, desc, signature, value); - FieldVisitor fv2 = cv2.visitField(access, name, desc, signature, value); - if (fv1 == null) - return fv2; - if (fv2 == null) - return fv1; - return new FieldVisitorTee(fv1, fv2); - } - - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - MethodVisitor mv1 = cv1.visitMethod(access, name, desc, signature, exceptions); - MethodVisitor mv2 = cv2.visitMethod(access, name, desc, signature, exceptions); - if (mv1 == null) - return mv2; - if (mv2 == null) - return mv1; - return new MethodVisitorTee(mv1, mv2); - } - - public void visitSource(String source, String debug) { - cv1.visitSource(source, debug); - cv2.visitSource(source, debug); - } - - public void visitOuterClass(String owner, String name, String desc) { - cv1.visitOuterClass(owner, name, desc); - cv2.visitOuterClass(owner, name, desc); - } - - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - return AnnotationVisitorTee.getInstance( - cv1.visitAnnotation(desc, visible), cv2.visitAnnotation(desc, visible)); - } - - public void visitAttribute(Attribute attrs) { - cv1.visitAttribute(attrs); - cv2.visitAttribute(attrs); - } - - public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { - return AnnotationVisitorTee.getInstance( - cv1.visitTypeAnnotation(typeRef, typePath, desc, visible), - cv2.visitTypeAnnotation(typeRef, typePath, desc, visible)); - } -} diff --git a/today-core/src/main/java/cn/taketoday/bytecode/transform/FieldVisitorTee.java b/today-core/src/main/java/cn/taketoday/bytecode/transform/FieldVisitorTee.java deleted file mode 100644 index 1a1d19e216..0000000000 --- a/today-core/src/main/java/cn/taketoday/bytecode/transform/FieldVisitorTee.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] - */ -package cn.taketoday.bytecode.transform; - -import cn.taketoday.bytecode.AnnotationVisitor; -import cn.taketoday.bytecode.Attribute; -import cn.taketoday.bytecode.FieldVisitor; -import cn.taketoday.bytecode.TypePath; - -public class FieldVisitorTee extends FieldVisitor { - - private final FieldVisitor fv1, fv2; - - public FieldVisitorTee(FieldVisitor fv1, FieldVisitor fv2) { -// super(Constant.ASM_API); - this.fv1 = fv1; - this.fv2 = fv2; - } - - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - return AnnotationVisitorTee.getInstance(fv1.visitAnnotation(desc, visible), fv2.visitAnnotation(desc, visible)); - } - - public void visitAttribute(Attribute attr) { - fv1.visitAttribute(attr); - fv2.visitAttribute(attr); - } - - public void visitEnd() { - fv1.visitEnd(); - fv2.visitEnd(); - } - - public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { - return AnnotationVisitorTee.getInstance(fv1.visitTypeAnnotation(typeRef, typePath, desc, visible), - fv2.visitTypeAnnotation(typeRef, typePath, desc, visible)); - } -} diff --git a/today-core/src/main/java/cn/taketoday/bytecode/transform/MethodVisitorTee.java b/today-core/src/main/java/cn/taketoday/bytecode/transform/MethodVisitorTee.java deleted file mode 100644 index 608400b8c9..0000000000 --- a/today-core/src/main/java/cn/taketoday/bytecode/transform/MethodVisitorTee.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Original Author -> Harry Yang (taketoday@foxmail.com) https://taketoday.cn - * Copyright © TODAY & 2017 - 2022 All Rights Reserved. - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see [http://www.gnu.org/licenses/] - */ -package cn.taketoday.bytecode.transform; - -import cn.taketoday.bytecode.AnnotationVisitor; -import cn.taketoday.bytecode.Attribute; -import cn.taketoday.bytecode.Handle; -import cn.taketoday.bytecode.Label; -import cn.taketoday.bytecode.MethodVisitor; -import cn.taketoday.bytecode.TypePath; - -/** - * @author Today
- * 2018-11-08 15:07 - */ -@SuppressWarnings({ "rawtypes", "unchecked" }) -public class MethodVisitorTee extends MethodVisitor { - private final MethodVisitor mv1; - private final MethodVisitor mv2; - - public MethodVisitorTee(MethodVisitor mv1, MethodVisitor mv2) { -// super(Constant.ASM_API); - this.mv1 = mv1; - this.mv2 = mv2; - } - - public void visitFrame(int type, int nLocal, Object[] local, int nStack, Object[] stack) { - mv1.visitFrame(type, nLocal, local, nStack, stack); - mv2.visitFrame(type, nLocal, local, nStack, stack); - } - - public AnnotationVisitor visitAnnotationDefault() { - return AnnotationVisitorTee.getInstance(mv1.visitAnnotationDefault(), mv2.visitAnnotationDefault()); - } - - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - return AnnotationVisitorTee.getInstance(mv1.visitAnnotation(desc, visible), mv2.visitAnnotation(desc, visible)); - } - - public AnnotationVisitor visitParameterAnnotation(int parameter, String desc, boolean visible) { - return AnnotationVisitorTee.getInstance(mv1.visitParameterAnnotation(parameter, desc, visible), - mv2.visitParameterAnnotation(parameter, desc, visible)); - } - - public void visitAttribute(Attribute attr) { - mv1.visitAttribute(attr); - mv2.visitAttribute(attr); - } - - public void visitCode() { - mv1.visitCode(); - mv2.visitCode(); - } - - public void visitInsn(int opcode) { - mv1.visitInsn(opcode); - mv2.visitInsn(opcode); - } - - public void visitIntInsn(int opcode, int operand) { - mv1.visitIntInsn(opcode, operand); - mv2.visitIntInsn(opcode, operand); - } - - public void visitVarInsn(int opcode, int var) { - mv1.visitVarInsn(opcode, var); - mv2.visitVarInsn(opcode, var); - } - - public void visitTypeInsn(int opcode, String desc) { - mv1.visitTypeInsn(opcode, desc); - mv2.visitTypeInsn(opcode, desc); - } - - public void visitFieldInsn(int opcode, String owner, String name, String desc) { - mv1.visitFieldInsn(opcode, owner, name, desc); - mv2.visitFieldInsn(opcode, owner, name, desc); - } - - public void visitMethodInsn(int opcode, String owner, String name, String desc) { - mv1.visitMethodInsn(opcode, owner, name, desc); - mv2.visitMethodInsn(opcode, owner, name, desc); - } - - public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - mv1.visitMethodInsn(opcode, owner, name, desc, itf); - mv2.visitMethodInsn(opcode, owner, name, desc, itf); - } - - public void visitJumpInsn(int opcode, Label label) { - mv1.visitJumpInsn(opcode, label); - mv2.visitJumpInsn(opcode, label); - } - - public void visitLabel(Label label) { - mv1.visitLabel(label); - mv2.visitLabel(label); - } - - public void visitLdcInsn(Object cst) { - mv1.visitLdcInsn(cst); - mv2.visitLdcInsn(cst); - } - - public void visitIincInsn(int var, int increment) { - mv1.visitIincInsn(var, increment); - mv2.visitIincInsn(var, increment); - } - - public void visitTableSwitchInsn(int min, int max, Label dflt, Label... labels) { - mv1.visitTableSwitchInsn(min, max, dflt, labels); - mv2.visitTableSwitchInsn(min, max, dflt, labels); - } - - public void visitLookupSwitchInsn(Label dflt, int keys[], Label labels[]) { - mv1.visitLookupSwitchInsn(dflt, keys, labels); - mv2.visitLookupSwitchInsn(dflt, keys, labels); - } - - public void visitMultiANewArrayInsn(String desc, int dims) { - mv1.visitMultiANewArrayInsn(desc, dims); - mv2.visitMultiANewArrayInsn(desc, dims); - } - - public void visitTryCatchBlock(Label start, Label end, Label handler, String type) { - mv1.visitTryCatchBlock(start, end, handler, type); - mv2.visitTryCatchBlock(start, end, handler, type); - } - - public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) { - mv1.visitLocalVariable(name, desc, signature, start, end, index); - mv2.visitLocalVariable(name, desc, signature, start, end, index); - } - - public void visitLineNumber(int line, Label start) { - mv1.visitLineNumber(line, start); - mv2.visitLineNumber(line, start); - } - - public void visitMaxs(int maxStack, int maxLocals) { - mv1.visitMaxs(maxStack, maxLocals); - mv2.visitMaxs(maxStack, maxLocals); - } - - public void visitEnd() { - mv1.visitEnd(); - mv2.visitEnd(); - } - - public void visitParameter(String name, int access) { - mv1.visitParameter(name, access); - mv2.visitParameter(name, access); - } - - public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { - return AnnotationVisitorTee.getInstance(mv1.visitTypeAnnotation(typeRef, typePath, desc, visible), - mv2.visitTypeAnnotation(typeRef, typePath, desc, visible)); - } - - public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) { - mv1.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs); - mv2.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs); - } - - public AnnotationVisitor visitInsnAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { - return AnnotationVisitorTee.getInstance(mv1.visitInsnAnnotation(typeRef, typePath, desc, visible), - mv2.visitInsnAnnotation(typeRef, typePath, desc, visible)); - } - - public AnnotationVisitor visitTryCatchAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) { - return AnnotationVisitorTee.getInstance(mv1.visitTryCatchAnnotation(typeRef, typePath, desc, visible), - mv2.visitTryCatchAnnotation(typeRef, typePath, desc, visible)); - } - - public AnnotationVisitor visitLocalVariableAnnotation(int typeRef, TypePath typePath, Label[] start, Label[] end, - int[] index, String desc, boolean visible) { - return AnnotationVisitorTee.getInstance( - mv1.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible), - mv2.visitLocalVariableAnnotation(typeRef, typePath, start, end, index, desc, visible)); - } -}