Spotbug : DLS: Dead store to a local variable (DLS_DEAD_LOCAL_STORE)

I have been getting a DLS spotbug for the last 2 days on my build attempts,
It is saying that one of my declared ArrayLists is not being used anywhere, while I am using the said list in the same function to populate some values returned from another function call.

I did some debugging and I can see that not only is my list in use but it is also populating correctly, Please advise on how to get over this issue.

@Crio.do Mentors, please look into my code as I don’t think this should really be an error over here

I checked online and a lot of the folks say that that specific bug is already deprecated in spotbugs

All help is appreciated

Hey, wherever you’re getting DLS, refactor and extract it to a method.
it should look like:

arraylist obj = extracted(parameter, parameter);

You can see the extracted method in your class somewhere.

i’m doing it something like this:

List< type > obj = new Arraylist< type >();

and then,

obj = function (); // this function returns a list of that object type

now, do i need to change the declaration or the funtion call?

***Never mind, got it

1 Like