Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Supported @SuppressWarnings Values in Android Studio

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 Eclipse because "null" doesn't work. You can catch null warnings with "all", but as you can imagine I'd rather not.

like image 684
Murkaeus Avatar asked Jul 11 '13 21:07

Murkaeus


People also ask

What does @SuppressWarnings mean?

@SuppressWarnings("unchecked") is used when Java generics just don't let you do what you want to, and thus, you need to explicitly specify to the compiler that whatever you are doing is legal and can be executed at the time of execution.

What does @SuppressWarnings unused mean?

The @SuppressWarnings annotation disables certain compiler warnings. In this case, the warning about deprecated code ( "deprecation" ) and unused local variables or unused private methods ( "unused" ).

What is @SuppressWarnings resource?

Adding the @SuppressWarnings({ "resource" }) should remove the warning for a potential resource leak. Adding a list for other ones, it's for Eclipse but they should be fairly similar for reference.

What does @SuppressWarnings mean in Java?

Use of @SuppressWarnings is to suppress or ignore warnings coming from the compiler, i.e., the compiler will ignore warnings if any for that piece of code. 1. @SuppressWarnings("unchecked") public class Calculator { } - Here, it will ignore all unchecked warnings coming from that class.


2 Answers

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.

enter image description here

like image 176
CrazyCoder Avatar answered Sep 27 '22 20:09

CrazyCoder


Look at this page for list of @SuppressWarnings :

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

like image 39
Sayed Abolfazl Fatemi Avatar answered Sep 27 '22 21:09

Sayed Abolfazl Fatemi