Forbidden APIs, also known as Policeman’s Forbidden API Checker, is a static analysis tool that identifies unwanted API usage in Java applications. It examines compiled bytecode and compares references to classes, methods and fields against configurable lists of forbidden signatures.
The tool helps developers enforce coding standards and avoid APIs that are deprecated, unsafe, non-portable or inappropriate for a particular project. Rather than relying on developers to remember every restriction, it can enforce the rules automatically during software builds.
Forbidden APIs is particularly useful for projects with strict compatibility requirements or established programming guidelines. Teams can define their own restrictions alongside the bundled rules, making it possible to enforce application-specific conventions.
The checker works with several established Java build tools and also provides a standalone command-line interface.
This is free and open source software.
Key Features
- Analyses Java bytecode to detect prohibited class, method and field references.
- Supports custom signature files defining APIs that must not be used.
- Includes bundled signatures for unsafe, deprecated, internal and non-portable JDK APIs.
- Detects potentially problematic calls that rely on default character encodings or locale settings.
- Identifies references to JDK implementation details that could compromise application portability.
- Supports restrictions on particular classes, constructors and methods.
- Allows wildcard patterns for matching groups of related classes.
- Provides configurable violation severity for individual signatures.
- Can fail automated builds when prohibited API usage is detected.
- Supports suppression annotations for explicitly permitted exceptions.
- Allows custom suppression annotations to avoid introducing checker-specific dependencies into application code.
- Automatically selects suitable bundled signature definitions according to the Java environment.
- Provides integration with Apache Maven, Gradle and Apache Ant.
- Offers a command-line interface for checking compiled Java applications independently of a build system.
Website: github.com/policeman-tools/forbidden-apis
Support:
Developer: Uwe Schindler and contributors
License: Apache License 2.0
Forbidden APIs is written in Java. Learn Java with our recommended free books and free tutorials.
Related Software
| Java Linter Tools | |
|---|---|
| SpotBugs | Find bugs in Java code |
| PMD | Extensible cross-language static code analyzer |
| Error Prone | Catch common Java mistakes |
| NullAway | Eliminate NPEs in Java code |
| Infer | Static analysis tool for Java, C++, Objective-C, and C |
| Checkstyle | Write Java code that adheres to a coding standard |
| Checker Framework | Pluggable type-checking for Java |
Read our verdict in the software roundup.
LinuxLinks helps you discover the best free and open source software for Linux. Explore our extensive collection of recommended applications, including alternatives to popular proprietary software.We also publish software reviews, Linux tutorials, hardware reviews, free programming books and articles covering the wider open source community. Browse our Linux resources to discover more. Know a useful free and open source Linux application we haven't covered? Suggest a program for inclusion. Has your software been featured on LinuxLinks? Display one of our Featured on LinuxLinks badges on your website or GitHub README. |


Please read our Comment Policy before commenting.