Reputation: 109
In my application lot of warnings are coming. For removing that warnings I'm using @SuppressWarnings annotations, anything would be happen in my code if I used several suppress warning annotations.
Upvotes: 0
Views: 67
Reputation: 5414
If you mean will my project break? or will it run slower most probably the answer is no. You can be fine suppressing warnings if they are trivial and you understand what are they signaling you and why are they there.
For example, an unused variable warning. Maybe you have defined it and plan to use in the near future, but the warning annoys you. Although I strongly suggest you to use a Source Code Version Control System like Git/Mercurial so you can safely delete code and recover a few days later.
But always check every warning you're suppressing: they are there for a purpose. For example, deprecated warnings: maybe your code runs fine, but in the next version of the JVM that deprecated method/class may have disappeared.
Always understand what you're doing
Upvotes: 0
Reputation: 3624
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"
). This article explains the possible values.
Upvotes: 1
Reputation: 207026
The @SuppressWarnings
annotation does not change anything to the way your code works. The only thing it does is not make your compiler or IDE complain about specific warnings.
If you feel you need to use @SuppressWarnings
a lot, then you should take a close look at why you get those warnings. It's a sign that you might be doing things incorrectly - you get warnings for a reason.
Upvotes: 4
Reputation: 1860
Depends on what warnings you are suppressing. If they are related to APIs that available only in new versions, your app will crash on older versions. Some warnings on the other hand are informational and point to common causes of bugs, so it really depends on what warning you are suppressing.
Upvotes: 0