2222
2323import act .app .AppByteCodeScannerBase ;
2424import act .asm .AnnotationVisitor ;
25+ import act .asm .ClassVisitor ;
2526import act .asm .FieldVisitor ;
2627import act .asm .Type ;
2728import act .db .CreatedAt ;
@@ -73,12 +74,20 @@ private class _ByteCodeVisitor extends ByteCodeVisitor {
7374
7475 boolean isMappedSuperClass ;
7576 boolean isEntity ;
77+ boolean isEntityListener ;
7678 String className ;
7779 boolean foundCreatedAt ;
7880 boolean foundLastModifiedAt ;
7981 boolean foundId ;
8082 MasterEntityMetaInfoRepo metaInfoRepo ;
8183
84+ public _ByteCodeVisitor (ClassVisitor cv ) {
85+ super (cv );
86+ }
87+
88+ public _ByteCodeVisitor () {
89+ }
90+
8291 @ Override
8392 public void visit (int version , int access , String name , String signature , String superName , String [] interfaces ) {
8493 super .visit (version , access , name , signature , superName , interfaces );
@@ -89,22 +98,28 @@ public void visit(int version, int access, String name, String signature, String
8998 @ Override
9099 public AnnotationVisitor visitAnnotation (String desc , boolean visible ) {
91100 AnnotationVisitor av = super .visitAnnotation (desc , visible );
92- isEntity = metaInfoRepo .isEntity (desc );
93- if (isEntity || isMappedSuperClass ) {
94- repo .registerEntityOrMappedSuperClass (className );
95- if (isEntity ) {
96- return new AnnotationVisitor (ASM5 , av ) {
97- @ Override
98- public void visit (String name , Object value ) {
99- if ("name" .equals (name ) || "value" .equals (name )) {
100- repo .registerEntityName (className , (String ) value );
101+ if (!isEntity && !isMappedSuperClass ) {
102+ isEntity = metaInfoRepo .isEntity (desc );
103+ isMappedSuperClass = metaInfoRepo .isMappedSuperClass (desc );
104+ if (isEntity || isMappedSuperClass ) {
105+ repo .registerEntityOrMappedSuperClass (className );
106+ if (isEntity ) {
107+ return new AnnotationVisitor (ASM5 , av ) {
108+ @ Override
109+ public void visit (String name , Object value ) {
110+ if ("name" .equals (name ) || "value" .equals (name )) {
111+ repo .registerEntityName (className , (String ) value );
112+ }
113+ super .visit (name , value );
101114 }
102- super .visit (name , value );
103- }
104- };
115+ };
116+ }
117+ }
118+ } else if (!isEntityListener ) {
119+ isEntityListener = metaInfoRepo .isEntityListener (desc );
120+ if (isEntityListener ) {
121+ repo .markEntityListenersFound (className );
105122 }
106- } else if (metaInfoRepo .isEntityListener (desc )) {
107- repo .markEntityListenersFound (className );
108123 }
109124 return av ;
110125 }
0 commit comments