Eclipse different behavior to prevent "Unchecked" due to "Potential heap contamination through the varargs parameter". How to fix?

I have a simple Entry object to populate a list

 public class Entry { //fields public Entry(int a, String b, String c) { //... } //some getters } 

and AsyncTask , which retrieve records.
On its onProgressUpdate ...

  (here) | @Override V protected void onProgressUpdate(List<Entry>... param) { for (Entry e : param[0]) myAdapter.add(e); progressBar.incrementProgressBy(1); myAdapter.notifyDataSetChanged(); } 

I have a warning:

Security Type: potential heap pollution through the varargs param parameter

This happens on a 64-bit Linux computer, and the warning opposite is shown on a laptop with the same version of Eclipse, the same Android project, the same Linux Mint 16, as the 32-bit OS, saying something like “delete this unnecessary annotation” (sorry if this is not an accurate warning, I'm on my desktop PC now).

So basically I add and delete back and forth annotation switching between two machines. I think this may be due, obviously, to the Java compiler used or to some other workspace setting.

Now I do not ask what the settings / environment difference really is, but my question is if there is something that I can do in the code to fix this problem and remove the warning itself origin. I read about the origin of this warning and what “heap pollution” means here, but not one source gives a hint of a possible fix (i.e. here or here )

Edit :
I noticed that another @SuppressWarnings("unchecked") is on doInBackground , where I call

 List<Entry> list; //inside a for statement: publishProgress(list); //repeated N times 

which gives this warning:

Security Type: A generic List array is created for the varargs parameter

+1
source share

All Articles