diff --git a/refactor/base/JavaRefactorListener.go b/refactor/base/JavaRefactorListener.go index 9d034a8039884fc93fcfea8376e64005c2ce9201..144abdf74f22106192ac59c97faa56f119d85eef 100644 --- a/refactor/base/JavaRefactorListener.go +++ b/refactor/base/JavaRefactorListener.go @@ -3,7 +3,6 @@ package base import ( . "../../language/java" . "./models" - "fmt" ) var node *JFullIdentifier; @@ -24,6 +23,9 @@ func (s *JavaRefactorListener) EnterPackageDeclaration(ctx *PackageDeclarationCo func (s *JavaRefactorListener) EnterImportDeclaration(ctx *ImportDeclarationContext) { importText := ctx.QualifiedName().GetText() + if ctx.MUL() != nil { + importText = importText + ".*" + } startLine := ctx.GetStart().GetLine() stopLine := ctx.GetStop().GetLine() @@ -99,7 +101,6 @@ func (s *JavaRefactorListener) EnterLambdaParameters(ctx *LambdaParametersContex func (s *JavaRefactorListener) EnterMethodCall(ctx *MethodCallContext) { text := ctx.IDENTIFIER().GetText() - fmt.Println(ctx.IDENTIFIER().GetText(), "......") startLine := ctx.GetStart().GetLine() stopLine := ctx.GetStop().GetLine() field := &JField{text, node.Pkg, startLine, stopLine} diff --git a/refactor/unused/remove_unused_import.go b/refactor/unused/remove_unused_import.go index 2a1d1c1b2397148458e430e74f905e129b6cc4ef..622b56f936995391fe5e6e307b3147d5d59126e3 100644 --- a/refactor/unused/remove_unused_import.go +++ b/refactor/unused/remove_unused_import.go @@ -62,11 +62,12 @@ func handleNode(node *JFullIdentifier) { for index := range imports { imp := imports[index] ss := strings.Split(imp.Name, ".") + fmt.Println(ss) lastField := ss[len(ss)-1] var isOk = false for _, field := range fields { - if field.Name == lastField { + if field.Name == lastField || lastField == "*" { isOk = true } }