2

I'm looking for a way to visualize the dependencies between classes in java and to possibly integrate this during build using gradle.

To provide an example I'm looking for a tool that in the following situation

class a{
    int a1;
    public function a2(){b bclass = new b();}
}

it will show that class a depends on class b.

What I'm trying to gain is to visualize how complex the design is and how we can simplify it.

2
  • Depending on how decoupled the project classes are, this might be quite a feat to accomplish. Commented Apr 20, 2015 at 10:20
  • Well, even checking the imports and parsing the code for the names of other classes should be fairly easy. Actually, I can probably write a script to do this, just grep each *.java for the filenames of every other *.java, if you find anything add a dependency. But I'd like to find something cleaner than my quick n dirty scripts Commented Apr 20, 2015 at 10:35

1 Answer 1

1

If a class depends on classes from different packages you could easily get list of imports using grep (unfortunately you can't use reflection here). Though finding out dependency classes residing in the same package would be a bit complex.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.