Coder Social home page Coder Social logo

java-callgraph-spoon's Introduction

java-callgraph-spoon

  • 使用静态分析工具spoon构造方法调用图callgraph,Use spoon build method to call graph cg
  • 从java源代码生成java调用图,generate a java call graph from java source code

keywords:java、callgraph、java-callgraph、cg、static analysis、source code analysis

run

download

`git clone https://github.com/nhjclxc/java-callgraph-spoon.git`

源代码方式启动 source code

导入idea的maven项目,进入 `org.nhjclxc.cg.SpoonCGProcessor.main()` ,在里面指定你要解析的java文件或是目录,之后直接启动,然后在项目顶级会出现一个`output`文件夹,dot格式的文件就在里面

jar方式启动 java -jar

  • cd java-callgraph-spoon
  • mvn clean package
  • cd target
  • java -jar java-callgraph-spoon-1.0-SNAPSHOT-jar-with-dependencies.jar path
    • java -jar java-callgraph-spoon-1.0-SNAPSHOT-jar-with-dependencies.jar "E:\nbu\other\java-callgraph-spoon\src\main\java\org\nhjclxc"
  • 随后在jar包目录下会生成一个 output 文件夹,生成的dot格式调用图就在里面

结果示例

build.dot build.png build.svg

可视化

  • 访问 Graphviz Online
  • 后期将尝试通过项目直接调用Graphviz工具生成图片,现在拿到dot的图结构其实就可以在这个基础上进行调用图的分析工作了,比如图相似性、向量化等等

注意

  • 如果提供的只是一个文件的话,只会分析该文件内部方法之间的调用。因此,建议你将要分析的java文件import里面包含的所有文件同时提供,否则生成的调用图只是单文件内部的调用关系(如果闲提供文件列表太繁琐,你可以把相关文件放到一个文件夹里面,提供文件夹路径即可构建该路径下面的所有*.java之间的函数调用关系)

  • 项目现在可能还不够完善,可能还存在一些分析不足的问题,后续将会补充完善

Author

License

java-callgraph-spoon's People

Contributors

nhjclxc avatar

Stargazers

朱槿 avatar  avatar  avatar h0n9xu avatar  avatar  avatar  avatar jnyq avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.