Fix WrongViewCast in Shell.java |
||
Issue description
Not sure if this is a false positive or valid: content/shell/android/java/src/org/chromium/content_shell/Shell.java#onFinishInflate
Error: ../SRC_ROOT1/content/shell/android/java/src/org/chromium/content_shell/Shell.java:150 Unexpected implicit cast to `Drawable`: layout tag was `LinearLayout`: WrongViewCast [warning]
mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackground();
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
,
Jan 31 2018
At first blush, that looks to be a false positive. The error in detection looks like it is evaluating only: (ClipDrawable) findViewById(R.id.toolbar) But in fact, we are casting getDrawable() to a ClipDrawable, which is correct.
,
Feb 1 2018
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e09f8de14e1138f1687db2492f662b040168e362 commit e09f8de14e1138f1687db2492f662b040168e362 Author: Ted Choc <tedchoc@google.com> Date: Thu Feb 01 00:00:32 2018 Pacify Wrong Cast lint warning by re-arranging Shell.java. Previous warning: Shell.java:150 Unexpected implicit cast to `Drawable`: layout tag was `LinearLayout`: WrongViewCast [warning] mProgressDrawable = (ClipDrawable) findViewById(R.id.toolbar).getBackground(); Apparently, the lint cast check is a bit too overzealous and doesn't understand when you access a property immediately. BUG= 807732 Change-Id: I4bd9ac6685e4bd9eae480dbdd19e5e67d0e9ff4f Reviewed-on: https://chromium-review.googlesource.com/895401 Commit-Queue: Ted Choc <tedchoc@chromium.org> Reviewed-by: Peter Wen <wnwen@chromium.org> Cr-Commit-Position: refs/heads/master@{#533478} [modify] https://crrev.com/e09f8de14e1138f1687db2492f662b040168e362/content/shell/android/java/src/org/chromium/content_shell/Shell.java
,
Feb 1 2018
|
||
►
Sign in to add a comment |
||
Comment 1 by wnwen@chromium.org
, Jan 31 2018