diff --git a/adapter/call/JavaCallListener.go b/adapter/call/JavaCallListener.go index 6eaecc09aff969b7822db0562cd3bf96498fa62a..74c84b11ccd9f38564c0c308dc797ff14c904459 100644 --- a/adapter/call/JavaCallListener.go +++ b/adapter/call/JavaCallListener.go @@ -101,15 +101,20 @@ func (s *JavaCallListener) EnterMethodCall(ctx *MethodCallContext) { stopLine := ctx.GetStop().GetLine() stopLinePosition := ctx.GetStop().GetColumn() - fullType := warpTargetFullType(targetType); + fullType := warpTargetFullType(targetType) if fullType != "" { - jMethodCall := &JMethodCall{fullType, targetType, callee, startLine, startLinePosition, stopLine, stopLinePosition} + jMethodCall := &JMethodCall{removeTarget(fullType), targetType, callee, startLine, startLinePosition, stopLine, stopLinePosition} methodCalls = append(methodCalls, *jMethodCall) } else { } } +func removeTarget(fullType string) string { + split := strings.Split(fullType, ".") + return strings.Join(split[:len(split)-1], ".") +} + func parseTargetType(ctx *MethodCallContext) string { var targetCtx = ctx.GetParent().GetChild(0).(antlr.ParseTree) targetVar := targetCtx.GetText(); diff --git a/adapter/models/JMethodCall.go b/adapter/models/JMethodCall.go index 50f60abffac883526e09af301808da26d2450baf..3a8e63926440b21bcab5ba47632e87cff7fbcda3 100644 --- a/adapter/models/JMethodCall.go +++ b/adapter/models/JMethodCall.go @@ -1,12 +1,11 @@ package models type JMethodCall struct { - Pkg string - Dlz string + Package string + Class string MethodName string StartLine int StartLinePosition int StopLine int StopLinePosition int } -