Supported @SuppressWarnings Values in Android Studio

后端 未结 4 687
轮回少年
轮回少年 2020-12-29 01:01

What are all of the supported values for @SuppressWarnings in Android Studio?

I couldn\'t find any documentation on it, and I know it isn\'t the same as

相关标签:
4条回答
  • 2020-12-29 01:28

    Look at this page for list of @SuppressWarnings :

    https://gist.github.com/elevenetc/bf795f94aaf3e92169ef

    0 讨论(0)
  • 2020-12-29 01:31

    Press Alt+Enter (Windows, Linux) or Option+Enter (OS X), then either press or click on the arrow pointing right at the end of "Replace with lambda...", finally select some of the Suppress... menu items available.

    0 讨论(0)
  • I couldn't get any of the above solutions work for me, or rather what they were saying seemed not to apply to my version of Android Studio (3.4.1) running on Windows 10. Here's what I did to solve this problem of not knowing what string value to supply to @SuppressWarnings

    I ran the "Analyze/Inspect Code..." for the module in question. You'll get an "Inspection Results" window. Navigate that window until you find the lint warning line that you want suppressed. Double clicking on the error message will take you to line of code that the warning message applies to. Right clicking on the error message will give you a drop-down menu, and you'll get an option to suppress the warning on a class, method or parameter basis. Select the way you want the warning message suppressed. Navigate to the code and you'll see the @SuppressWarning line that was added. You'll see the actual string parameter passed to the @SuppressWarning line.

    If you rerun "Analyze/Inspect Code.." again, that same warning will show up in the "Inspection Result" window, but this time you'll see that the line will also say that it's suppressed.

    0 讨论(0)
  • 2020-12-29 01:48

    This is very simple, just click on the deprecated word and press ALT + ENTER on your keyboard, click on --> Inspection 'Deprecated API usage' options. In the drop-down menu, u can select the option that matches your choice, e.g Suppress for class, Suppress for method, Suppress for statement.. Hope it helps.

    0 讨论(0)
提交回复
热议问题