Эх сурвалжийг харах

clean => 去除多余的代码

JustryDeng 2 жил өмнө
parent
commit
9eb108dd4e

+ 7 - 11
class-winter-core/src/main/java/winter/com/ideaaedi/classwinter/util/JavassistUtil.java

@@ -161,17 +161,13 @@ public final class JavassistUtil {
         }
         // 删除指定注解
         StrUtil.strToSet(toCleanAnnotationPrefix, "\\|").forEach(x -> attributeInfoList.forEach(y -> {
-            try {
-                if (y instanceof AnnotationsAttribute) {
-                    AnnotationsAttribute annotationsAttribute = (AnnotationsAttribute) y;
-                    Annotation[] annotations = annotationsAttribute.getAnnotations();
-                    Annotation[] newAnnotations = Arrays.stream(annotations)
-                            .filter(annotation -> !annotation.getTypeName().startsWith(x))
-                            .toArray(Annotation[]::new);
-                    annotationsAttribute.setAnnotations(newAnnotations);
-                }
-            } catch (Exception e) {
-                throw e;
+            if (y instanceof AnnotationsAttribute) {
+                AnnotationsAttribute annotationsAttribute = (AnnotationsAttribute) y;
+                Annotation[] annotations = annotationsAttribute.getAnnotations();
+                Annotation[] newAnnotations = Arrays.stream(annotations)
+                        .filter(annotation -> !annotation.getTypeName().startsWith(x))
+                        .toArray(Annotation[]::new);
+                annotationsAttribute.setAnnotations(newAnnotations);
             }
         }));
         return true;