I have a simple Entry
object for populating a list
public class Entry {
//fields
public Entry(int a, String b, String c) {
//...
}
//some getters
}
and an AsyncTask
that retrieves the entries.
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 the warning:
Type safety: Potential heap pollution via varargs parameter param
This happens on a PC Linux 64bit while the opposite warning is shown on a notebook with the same version of Eclipse, same android project, same Linux Mint 16, just a 32bit OS, stating something as "remove this unnecessary annotation" (sorry if this is not the precise warning, I'm on the desktop PC now).
So basically I add and remove back and forth the annotation, switching between the two machines. I think this may be related, obviously, to the Java compiler in use or some other workspace setting.
Now, I'm not asking what actually is that setting/environment difference, but my question is if there is something that I can do in the code to fix this issue and remove the origin of the warning itself. I've read about the origin of this warning and what "heap pollution" means here, but no source gives a hint on a possible fix (i.e. here or here)
Edit:
I noticed that another @SuppressWarnings("unchecked")
sits on doInBackground
,
where I call
List<Entry> list;
//inside a for statement:
publishProgress(list);
//repeated N times
that gives this warning:
Type safety: A generic array of List is created for a varargs parameter