diff --git a/core/adapter/call/java_call_app_test.go b/core/adapter/call/java_call_app_test.go index da8e0924c3e763204766920005c3fa1fddeb810a..6a08bd95408ca5a9d0e4a7095fd7fa6e66613e48 100644 --- a/core/adapter/call/java_call_app_test.go +++ b/core/adapter/call/java_call_app_test.go @@ -99,6 +99,7 @@ func TestAnnotation(t *testing.T) { methodMap[c.Name] = c } + g.Expect(len(callNodes[0].Annotations)).To(Equal(0)) g.Expect(methodMap["macOsXPositiveTest"].Name).To(Equal("macOsXPositiveTest")) for _, call := range methodMap["macOsXPositiveTest"].MethodCalls { diff --git a/core/adapter/call/java_call_listener.go b/core/adapter/call/java_call_listener.go index f2a76d5aad1cfeb2579decbec3ed9c4a78da621c..b91ce33bac4aef4f23d0c4d2c156253ffe97dad4 100644 --- a/core/adapter/call/java_call_listener.go +++ b/core/adapter/call/java_call_listener.go @@ -248,7 +248,11 @@ func (s *JavaCallListener) EnterAnnotation(ctx *parser.AnnotationContext) { currentMethod.Annotations = append(currentMethod.Annotations, annotation) } else { annotation := common_listener.BuildAnnotation(ctx) - currentNode.Annotations = append(currentNode.Annotations, annotation) + if currentType == "Creator" { + currentCreatorNode.Annotations = append(currentCreatorNode.Annotations, annotation) + } else { + currentNode.Annotations = append(currentNode.Annotations, annotation) + } } }