Fix WebView compilation warnings |
||||||
Issue description
I get the followign warnings when compiling WebView:
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:12: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
import android.widget.ZoomButtonsController;
^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:18: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
private ZoomButtonsController mZoomButtonsController;
^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:25: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
ZoomButtonsController zoomController = getZoomController();
^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:32: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
ZoomButtonsController zoomController = getZoomController();
^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:39: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
ZoomButtonsController zoomController = getZoomController();
^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:61: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
private ZoomButtonsController getZoomController() {
^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:64: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
mZoomButtonsController = new ZoomButtonsController(
^
../../android_webview/java/src/org/chromium/android_webview/AwZoomControls.java:79: warning: [deprecation] ZoomButtonsController in android.widget has been deprecated
private class ZoomListener implements ZoomButtonsController.OnZoomListener {
^
../../android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java:40: warning: [unchecked] unchecked call to getDeclaredMethod(String,Class<?>...) as a member of the raw type Class
Method getUserOptInPreference = awSafeBrowsingApiHelperClass.getDeclaredMethod(
ZoomButtonsController is deprecated:
"@deprecated This functionality and UI is better handled with custom views and layouts
* rather than a dedicated zoom-control widget"
We should either suppress that deprecation warning, or fix it.
Regarding AwSafeBrowsingConfigHelper I'm not sure why we don't provide an API for AwSafeBrowsingApiHandler in the public chromium code, and then implement that in the internal clank code (I guess it might be difficult to find a good spot during WebView startup to instantiate AwSafeBrowsingApiHandler) . Nate, why are we using reflection here instead of an interface + implementation class?
,
Aug 16 2017
upstreaming for O is happening real soon now, probably wait for that first > We should either suppress that deprecation warning, or fix it. We still have to implement deprecated things, so need to suppress them. I think I tried suppressing once long ago, and for some reason, the annotation didn't make the warning go away, so I just gave up
,
Aug 16 2017
That particular Safe Browsing class is unrelated to O, so I'll suppress the warning now. The other warnings aren't mine, so someone can feel free to take this from me. Bo, it looks like that class is internal code--why do we need to use deprecated classes if it's not for an API?
,
Aug 17 2017
it's implementing a deprecated feature
,
Aug 17 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/e2d22cf660126d4290da10eb8fd8f6fa60eb0d0c commit e2d22cf660126d4290da10eb8fd8f6fa60eb0d0c Author: Nate Fischer <ntfschr@chromium.org> Date: Thu Aug 17 05:04:14 2017 AW: suppress compile warning This suppresses a compile warning for an unchecked reflection call on AwSafeBrowsingApiHandler. The class will always have the method to fetch user opt-in preference, so it's safe to ignore the warning. Bug: 755922 Test: ninja system_webview_google_apk system_webview_apk monochrome_apk Change-Id: If14900d9bdc42bbb01d4e9f65a0e19f9f0678d12 Reviewed-on: https://chromium-review.googlesource.com/618304 Reviewed-by: Bo <boliu@chromium.org> Commit-Queue: Nate Fischer <ntfschr@chromium.org> Cr-Commit-Position: refs/heads/master@{#495079} [modify] https://crrev.com/e2d22cf660126d4290da10eb8fd8f6fa60eb0d0c/android_webview/java/src/org/chromium/android_webview/AwSafeBrowsingConfigHelper.java
,
Aug 17 2017
The remaining work is to suppress warnings on ZoomButtonsController. This is mostly mechanical, so I'll pass this off as a 1st bug for a noogler. If someone wants this fixed sooner, I can land the patch.
,
Aug 30 2017
Assign back if you don't want this for a noogler bug. --- For whoever takes this up next, you'll need to look up how to suppress warnings for deprecated classes (to suppress the warning from the import statement).
,
Sep 12 2017
I found more deprecation warnings in the glue layer, which should be resolved the same way:
---
../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:8: warning: [deprecation] WebIconDatabase in android.webkit has been deprecated
import android.webkit.WebIconDatabase;
^
../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:9: warning: [deprecation] WebIconDatabase in android.webkit has been deprecated
import android.webkit.WebIconDatabase.IconListener;
^
../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:9: warning: [deprecation] WebIconDatabase in android.webkit has been deprecated
import android.webkit.WebIconDatabase.IconListener;
^
../../android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java:9: warning: [deprecation] IconListener in WebIconDatabase has been deprecated
import android.webkit.WebIconDatabase.IconListener;
,
Sep 23 2017
Passing to jamwalla@ See examples for how to suppress deprecation warnings: https://cs.chromium.org/search/?q="@SuppressWarnings(%5C"deprecation%5C")"+lang:java
,
Sep 25 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634 commit 3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634 Author: James Wallace-Lee <jamwalla@chromium.org> Date: Mon Sep 25 22:40:59 2017 WebView: suppress deprecation warnings supress deprecation warnings on ZoomButtonsController and WebIconDatabase BUG= 755922 Change-Id: I7b0f6769127b45245652afcd53615d2f2fcde985 Reviewed-on: https://chromium-review.googlesource.com/682997 Reviewed-by: Paul Miller <paulmiller@chromium.org> Reviewed-by: Bo <boliu@chromium.org> Commit-Queue: James Wallace-Lee <jamwalla@chromium.org> Cr-Commit-Position: refs/heads/master@{#504192} [modify] https://crrev.com/3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634/android_webview/glue/java/src/com/android/webview/chromium/WebIconDatabaseAdapter.java [modify] https://crrev.com/3b09d5a1ec7d5ee8685e8b3fedc5d259d23bd634/android_webview/java/src/org/chromium/android_webview/AwZoomControls.java
,
Oct 3 2017
Is there remaining work for this bug?
,
Oct 3 2017
|
||||||
►
Sign in to add a comment |
||||||
Comment 1 by ntfschr@chromium.org
, Aug 16 2017Owner: ntfschr@chromium.org
Status: Assigned (was: Unconfirmed)