j0hnl33 / apps-for-android

Automatically exported from code.google.com/p/apps-for-android
Apache License 2.0
0 stars 0 forks source link

Unsuppressed warning in Photostream #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
[Reported against r20 of Photostream]

As previously reported, there's an unchecked warning in UserTask.java

photostream\UserTask.java:215: warning: [unchecked]
 unchecked generic array creation of type Result[] for varargs parameter
  new UserTaskResult<Result>(UserTask.this, result));

Caused by mixing generics with arrays in the UserTaskResult constructor:

  UserTaskResult(UserTask task, Data... data)

I suspect there's something unsavory about the use of varargs in the
swingworker-style task class, but I don't have a suggested fix, and,
furthermore, the code is actually safe in this instance.

Fix: Please annotate this statement to suppress the needless warning.

 @SuppressWarnings("unchecked")
 final Message message = sHandler.obtainMessage(MESSAGE_POST_RESULT,
   new UserTaskResult<Result>(UserTask.this, result));

(As per Item 26 in Effective Java, 2nd Ed.)

Original issue reported on code.google.com by joe.bowb...@gmail.com on 2 Sep 2008 at 10:11

GoogleCodeExporter commented 8 years ago

Original comment by romaingu...@gtempaccount.com on 3 Sep 2008 at 3:04