3

I am using LiveData and Databinding and I get 10s and 10s of warnings at compile time looking like:

warning: xxx.getValue() is a boxed field but needs to be un-boxed to execute bind:visibility. This may cause NPE so Data Binding will safely unbox it. You can change the expression and explicitly wrap xxx.getValue() with safeUnbox() to prevent the warning

Is there a possibility to disable these warnings so that they won't show up when compiling? I don't want to wrap everything with safeUnbox().

Edit*: just to be clear. I am not asking how to handle the safeUnbox warning or what to do in order for the warning to not show up. I want to know if it is possible to disable the warning from showing up in my log output at compile time.

Rik van Velzen
  • 1,977
  • 1
  • 19
  • 37
  • This can help you, please [help](https://stackoverflow.com/questions/42872201/data-binding-safeunbox-warning) – Anu Bhalla Oct 24 '18 at 08:53
  • 1
    @AnuChaudhary yes, i saw that post, but it's not really helpful. I need (and want) to keep using LiveData. Data binding is already safely unboxing the fields. Just need to know if and how i can disable the compile time warnings. – Rik van Velzen Oct 24 '18 at 09:24
  • @SuppressWarnings("unchecked") can be used with specific variable, causing error. – Anu Bhalla Oct 24 '18 at 09:31
  • Are you using non-primitive variables in binding. Here is an helping answer. https://stackoverflow.com/a/52314942/6891563 – Khemraj Sharma Oct 24 '18 at 11:31

0 Answers0