2

How could i fix this warning?

Type safety: Unchecked cast from List to List<ArrayObject>

List<List<ArrayObject>> detailList = search.getDetails(
    (List<ArrayObject>) ((DefaultListBackedValueList) request.getAttribute(LIST)).getList());
Pablo Grela
  • 21
  • 1
  • 2

1 Answers1

1

Since getAttribute() is not parameterized method and returns Object there is no way to fix the warning. You have to suppress it.

When I have to suppress warning I typically try to decrease the scope of suppression. In your case you can suppress warning on current statement or create special method that returns List<ICTWeb> and suppress warning there. You can also write a short comment that describes why do you suppress warning.

BTW I have no idea why are you using double casting (List<ArrayObject>) ((DefaultListBackedValueList). I believe it is no necessary.

AlexR
  • 109,181
  • 14
  • 116
  • 194