google / google/error-prone

RFE: configurable DoNotCall/RestrictedApi/JdkObsolete/DefaultCharset/JavaTimeDefaultTimeZone check

Open
#1,211 2 comments 4 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
7.2k
Forks
820
Avg merge
5h 9m
Merged PRs (30d)
50

Description

### Description of the problem / feature request:

I'm currently using [Policeman's Forbidden API Checker](https://github.com/policeman-tools/forbidden-apis) in addition to Error Prone. Some checks are duplicate of what Error Prone provides (default charset, default timezone), but Forbidden APIs provides additional checks (e.g. APIs using the default locale, no `System.out`/`System.err` or `printStackTrace()`), and allows one to add new checks through simple text files.

It occurred to me that those checks could be done at compile-time by Error Prone itself.

### Feature requests: what underlying problem are you trying to solve with this feature?

Remove a tool that duplicates (some) functionality of Error Prone and runs later during the build (also contributing to build time); bringing its features to Error Prone itself:
* more checks: default locale, no `System.out`/`System.err`, or `printStackTrace()`
* configurable "forbidden APIs" checks (à la DoNotCall, RestrictedAPI, JdkObsolete, DefaultCharset, or JavaTimeDefaultTimeZone) through simple text files (rather than writing dedicated Error Prone checks). Alternatively, make it dead-easy to build such checks (possibly using protobuf to store the forbidden signatures, à la ApiDiff).

I might try to build those as custom checks (if I find time), but thought you might be interested in adding this right into Error Prone itself.

### What version of Error Prone are you using?

2.3.2

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.