Adrninistrator / java-all-call-graph

Generate all call graph for Java Code.
Apache License 2.0
426 stars 110 forks source link

特殊场景链路缺失 #34

Closed john-70 closed 1 year ago

john-70 commented 1 year ago
  1. 父类BaseService 与接口IService 无直接关联(间接通过子类AService 产生关联)
  2. 父类BaseService 实现了IService 接口doing()方法
  3. 字段定义时使用的类型为接口( private IService service;)
    
    public interface IService {
    void doing();
    }

public class BaseService { public void doing() { System.out.println("it's base"); } }

@Service public class AService extends BaseService implements IService { }

@Controller public class TestController { @Autowired private IService service;

public void doing() {
    service.doing();
}

}

Adrninistrator commented 1 year ago

等我有空了看一下,这个写法看起来比较特殊

Adrninistrator commented 1 year ago

我试了一下现在方法调用是能够关联起来的,看起来没有问题,可以发一下预期和实际的情况不

john-70 commented 1 year ago

实际情况

org.testcase4.TestController:doing()
[0]#org.testcase4.TestController:doing()
[1]#  [TestController:12]   org.testcase4.IService:doing()

预期

org.testcase4.TestController:doing()
[0]#org.testcase4.TestController:doing()
[1]#  [TestController:12]   org.testcase4.IService:doing()
[2]#    [IService:0]    org.testcase4.BaseService:doing()
或者
org.testcase4.TestController:doing()
[0]#org.testcase4.TestController:doing()
[1]#  [TestController:12]   org.testcase4.BaseService:doing()
john-70 commented 1 year ago

注意父类与接口无继承关系,代码中变量声明使用的是接口

Adrninistrator commented 1 year ago

确实,我测试的时候把父类实现了接口,这种情况没有问题 上面的写法也太特殊了

Adrninistrator commented 1 year ago

可以发个邮件不,我的邮箱在项目里有

Adrninistrator commented 1 year ago

最新版,1.0.11,解决了这个问题