New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 640148 link

Starred by 2 users

Issue metadata

Status: Untriaged
Owner: ----
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Task



Sign in to add a comment

Java build or lint should fail when not all IntDef enum values are handled in a switch

Project Member Reported by mvanouwe...@chromium.org, Aug 23 2016

Issue description

It might be neat for the Java build or lint to fail when not all IntDef enum values are handled in a switch statement.

Adding some people on CC that might be interested.
 
Cc: tedc...@chromium.org bsazonov@chromium.org
Reviving this issue and cc-ing Ted. I agree with Michael that we should enforce that all IntDef values are handled by switches.

suppressions.xml has a comment about this warning: "We have many C++ enums that we don't care about in java". I think we should suppress these cases with explicit @SuppressLint("SwitchIntDef").

[1] https://cs.chromium.org/chromium/src/build/android/lint/suppressions.xml?l=290&rcl=6be377dc25152e14ae50fd87c388712c27367712
Labels: -Type-Feature Type-Task
FIY: I've run AS inspection and found ~70 warnings for this issue. Some of these warnings can be fixed by adding missing values to the switch, but some require @SuppressLint("SwitchIntDef").
I have no strong objections to this.
Another FIY: this came up during a code review. I hope that adding this check would remove the need for comments like this one: https://chromium-review.googlesource.com/c/chromium/src/+/1262644/3/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/ClearBrowsingDataPreferences.java#200.

Sign in to add a comment