Skip to main content Skip to navigation

Ndepend Java |verified|

This provides a business-friendly metric to justify refactoring. For Java teams, this is often missing—SonarQube has similar concepts, but NDepend’s model is more transparent and customizable.

- name: Run NDepend analysis run: | NDepend.Console.exe -ProjectFile myJavaProject.ndproj -OutDir ./NDepend_Output -Silent ndepend java

Modern Java uses heavy lambdas and streams ( map , filter , collect ). Because the Java compiler generates synthetic methods for lambdas, NDepend’s bytecode reader may count these synthetic methods as separate "methods," slightly inflating complexity metrics. NDepend has filters for synthetic members, but you may need to tweak them. Because the Java compiler generates synthetic methods for

// Find Java methods that throw generic Exception (bad practice) from m in Methods where m.IsPublic && m.CaughtExceptions.Contains("java.lang.Exception") select m queries | Coding standards

| Feature | NDepend for Java | Checkstyle / SpotBugs | SonarQube | |---------|------------------|----------------------|------------| | | Architecture, dependencies, metrics, queries | Coding standards, bug patterns | All-in-one quality gate | | Query Language | CQLinq (expressive, custom rules) | XML/Java (limited) | XPath (for custom rules) | | Dependency Visualization | Interactive graphs & matrices | None | Basic (paid edition) | | Technical Debt Estimation | Built-in, customizable | None | Yes (opaque formula) | | Evolution / Diff | Rich diff reports | None | Yes (with editions) | | Cost | Commercial (per user/CI) | Free | Free core + commercial | | Learning Curve | Steep (CQLinq, metrics) | Shallow | Moderate |