Developer tools · 6 tools
Top 6 static analysis tools for Java and Kotlin codebases
PMD, Error Prone and SonarQube are the closest fits for finding bugs and enforcing standards in Java and Kotlin code, followed by detekt for Kotlin, Infer and CodeQL. This shortlist is for JVM backend and Android teams deciding which analyzers to add to their builds.
| # | Tool | Best for | Key feature | Platforms / deployment | Pricing | More |
|---|---|---|---|---|---|---|
| 1 | PMDPMD | Rule-based checks across Java and Kotlin | More than 400 built-in rules | Command line; Windows install via Chocolatey; IDE and CI plugins | See vendor pricing page | Official site |
| 2 | Error ProneGoogle | Catching Java mistakes during compilation | Augments the compiler's type analysis | Integrates with the standard build, for example Bazel Java compilation | See vendor pricing page | Official site |
| 3 | SonarQubeSonar | Teams that want quality gates on every pull request | Analyzes branches and pull requests across 45+ languages | Managed cloud or self-hosted server; pull request integration on major Git platforms; common editors | See vendor pricing page | Official site |
| 4 | detektdetekt | Kotlin and Android projects on Gradle | First-party Gradle plugin, plus Maven and Bazel plugins | Gradle, Maven and Bazel plugins; Android, JVM, JS, Native and Multiplatform | See vendor pricing page | Official site |
| 5 | InferMeta | Deep bug finding in Java and Android code | Null pointer exception checks for Android and Java | Java, C, C++, Objective-C and Erlang code; Android and iOS developers | See vendor pricing page | Official site |
| 6 | CodeQLGitHub | Security researchers and open source maintainers | Query code as if it were data | CodeQL CLI and Visual Studio Code extension | See vendor pricing page | Official site |
1 PMD
By PMD
PMD is an extensible, cross-language static source code analyzer that finds common flaws such as unused variables, empty catch blocks and unnecessary object creation.
Why it is here: It focuses mainly on Java, supports Kotlin, and runs from the command line, which makes it easy to add to a JVM build.
- Best for
- Rule-based checks across Java and Kotlin
- Key features
- More than 400 built-in rules
- Custom rules written in Java or as XPath queries
- Supports Java, Kotlin and many other languages
- CPD copy-paste detector for duplicated code
- IDE and CI plugins, including an Eclipse plugin
- Watch out for
- Documented as rule-based analysis of source files; the pages we used do not describe the build-system plugins in detail, so check the vendor documentation for your build tool. Scala is supported but has no rules available.
- Platforms / deployment
- Command line; Windows install via Chocolatey; IDE and CI plugins
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
2 Error Prone
By Google
Error Prone is a Google-developed, open-source tool that augments the Java compiler's type analysis to catch mistakes at build time.
Why it is here: It hooks into the standard build so every developer runs it automatically, which makes it a direct fit for Java builds.
- Best for
- Catching Java mistakes during compilation
- Key features
- Augments the compiler's type analysis
- Hooks into the standard build
- Findings surface as compilation errors
- Named bug patterns such as CollectionIncompatibleType
- Suggested fixes that tooling can build on
- Watch out for
- Documented for the Java compiler; teams with Kotlin code should check the vendor documentation or pair it with a Kotlin analyzer.
- Platforms / deployment
- Integrates with the standard build, for example Bazel Java compilation
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
3 SonarQube
By Sonar
SonarQube is a code quality and security platform that automates reviews and verification of human-written and AI-generated code. It is available as managed cloud or self-hosted server.
Why it is here: It covers bugs, maintainability and security across many languages in pull requests, so it suits teams that want one shared quality gate.
- Best for
- Teams that want quality gates on every pull request
- Key features
- Analyzes branches and pull requests across 45+ languages
- Quality gates decide what merges
- SAST and taint analysis for injection flaws
- Secrets detection in the IDE, commits and pull requests
- Self-managed Server edition, including air-gapped
- Watch out for
- SCA requires SonarQube Advanced Security. Teams should check the vendor documentation for how Java and Kotlin are covered and which edition offers which feature.
- Platforms / deployment
- Managed cloud or self-hosted server; pull request integration on major Git platforms; common editors
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
4 detekt
By detekt
detekt is an open-source static code analyzer for Kotlin that detects code smells and is configurable and extensible.
Why it is here: It is built for Kotlin and ships a first-party Gradle plugin, but it does not cover Java, so it follows the tools that analyze both.
- Best for
- Kotlin and Android projects on Gradle
- Key features
- First-party Gradle plugin, plus Maven and Bazel plugins
- Supports Android, JVM, JS, Native and Multiplatform projects
- Baselines for legacy projects
- HTML, Markdown, SARIF and Checkstyle report formats
- Wrapper over ktlint as a rule set
- Watch out for
- Documented for Kotlin; teams with Java code need another analyzer alongside it.
- Platforms / deployment
- Gradle, Maven and Bazel plugins; Android, JVM, JS, Native and Multiplatform
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
5 Infer
By Meta
Infer is a static program analyzer, written in OCaml, that produces a list of potential bugs in Java, C, C++, Objective-C and Erlang code.
Why it is here: It targets bugs across functions and files in Java and Android code, but its checks are specific, and Kotlin is not listed.
- Best for
- Deep bug finding in Java and Android code
- Key features
- Null pointer exception checks for Android and Java
- Resource leaks and race conditions
- Missing lock guards and annotation reachability
- Reasoning across multiple functions or files
- Runs in Meta's continuous integration pipeline
- Watch out for
- Kotlin is not listed on the pages we used, so Kotlin-heavy teams should check the vendor documentation.
- Platforms / deployment
- Java, C, C++, Objective-C and Erlang code; Android and iOS developers
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
6 CodeQL
By GitHub
CodeQL is GitHub's semantic code analysis engine that lets users query code as though it were data to find vulnerabilities across a codebase.
Why it is here: It is a query-based engine aimed at security research and open source work, with licensing limits, so it fits fewer teams here.
- Best for
- Security researchers and open source maintainers
- Key features
- Query code as if it were data
- Write and share queries for variants of a vulnerability
- Taint tracking
- Visual Studio Code extension for running queries
- CLI that builds a database for a Java project from a language and build command
- Watch out for
- Use is restricted to OSI-approved open source codebases, academic research, or specific automated-analysis cases; other CI/CD use must be arranged with the vendor. Kotlin is not listed on the pages we used.
- Platforms / deployment
- CodeQL CLI and Visual Studio Code extension
- Pricing
- See vendor pricing page (not quoted here; facts checked 21 November 2026, Asia/Dhaka)
How we chose these tools
We looked at how directly each tool fits Java and Kotlin work: documented language support, the checks it performs, and how the documentation describes adding it to builds, editors and CI. The facts for each tool come from official vendor pages, recorded with the dates we checked them, and we add nothing beyond those pages.
The order reflects editorial fit for this use case, with tools that are documented for JVM languages and straightforward to wire into a build placed first. It does not say any tool is better overall, since these analyzers target different problems and teams often combine them. The list is built from documentation rather than product trials, so where the documentation is silent we say so and point you to the vendor.
Order used in this guide: Ordered by direct fit for JVM languages and ease of adding to builds.
Frequently asked questions
Which static analysis tool is built specifically for Kotlin?
detekt is a static analyzer for Kotlin that detects code smells. It supports Android, JVM, JS, Native and Multiplatform projects and has a first-party Gradle plugin.
Does PMD support both Java and Kotlin?
Yes. PMD focuses mainly on Java and Apex and supports Kotlin among many other languages. It ships with more than 400 built-in rules and can be extended with custom rules.
How does Error Prone differ from other analyzers?
Error Prone augments the Java compiler's type analysis and hooks into the standard build, so its findings appear as compilation errors with named bug patterns and suggested fixes.
Can CodeQL be used on any CI pipeline?
Not necessarily. Use is restricted to OSI-approved open source codebases, academic research, or specific automated-analysis cases, and other CI/CD use must be arranged with the vendor.
Can I adopt detekt on a legacy Kotlin project?
detekt supports baselines, which let a legacy project suppress existing issues while ensuring no new issues are introduced.
- PMD: pmd.github.io — checked 21 November 2026
- Error Prone: errorprone.info — checked 21 November 2026
- SonarQube: sonarsource.com/products/sonarqube — checked 21 November 2026
- detekt: detekt.dev, detekt.dev/docs/intro — checked 21 November 2026
- Infer: fbinfer.com, fbinfer.com/docs/about-Infer — checked 21 November 2026
- CodeQL: codeql.github.com — checked 21 November 2026
Logicwick is independent and not affiliated with the vendors listed. The editorial order is unpaid. A vendor may buy one clearly labeled featured slot per guide, sold to only one company, and we still check its facts; see our disclosure. Product names belong to their owners. Features and prices change; confirm details on each official website.