Android Studio gets stale warning even with @SuppressWarnings ("deprecation")

In Android Studio, we get an outdated warning during build. This code is in onCreate (Bundle) activity

String databasePath = webView.getContext().getDir("databases", Context.MODE_PRIVATE).getPath(); webSettings.setDatabaseEnabled(true); webSettings.setDatabasePath(databasePath); 

Method has these annotations

 @SuppressLint("SetJavaScriptEnabled") @SuppressWarnings("deprecation") @TargetApi(19) @Override public void onCreate(Bundle savedInstanceState) { 

I know that setDatabasePath is deprecated, but we need this for backward compatibility.

I thought this would hide the warning. When we do the compilation task, I see a message like

... / application / SRC / main / Java / com /.../ WebframeActivity.java Warning: (106, 15) [debrecation] setDatabasePath (String) in WebSettings is deprecated

I thought the @SuppressWarnings annotation would not report this as a warning. What can I do? Is this a mistake, or am I not noticing my mistake?

+6
source share

Source: https://habr.com/ru/post/979521/


All Articles