google / google/error-prone

Allow "found raw type" to upgrade to an error - Do not allow raw types

Open
#1,799 4 comments 0 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:

The Java compiler issues "found raw type" warnings when a generic type is used without providing actual generic type arguments. (i.e. opting out of generics)
It would be nice if Error Prone had its own warning for this, that more importantly, can be upgraded to an error, and so prevent new code from using raw types.

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

It's been about 16 years since Java introduced generics. It was always recommended to avoid using raw types in new code. The only reason it allowed raw types was for backwards comparability with pre-generics written code.
Yet programmers still to this day write NEW code that uses raw types, either by mistake, or due to laziness, or ignorance of the importance of always using actual generic arguments. It would be nice to enforce this, mostly so the code is cleaner, more consistent, less confusing, does not generate warnings (that are ignored,) and of course, more type-safe.

### Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

`List stuff;`

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

2.3.4

### Have you found anything relevant by searching the web?

No.

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.