> Comparator doesn't implement Serializable
> org.apache.pivot.wtk.text.Element$NodeOffsetComparator implements
> Comparator but not Serializable
> org.apache.pivot.wtk.TableView$RowComparator implements Comparator but
> not Serializable
> org.apache.pivot.wtk.TreeView$PathComparator implements Comparator but
> not Serializable
> org.apache.pivot.tutorials.TreeNodeComparator implements Comparator
> but not Serializable
> org.apache.pivot.collections.List$SimpleComparator implements
> Comparator but not Serializable
> org.apache.pivot.io.Folder$FileNameComparator implements Comparator
> but not Serializable
> org.apache.pivot.io.FileList$FilePathComparator implements Comparator
> but not Serializable
Why is it recommended that Comparator implementations also implement
Serializable? If that were mandatory, Comparator would be a sub-interface
of Serializable...
> Folder.java:224 Nullcheck of fileList at line 228 of value previously
> dereferenced
> files = new ArrayList<File>(fileList.length);
> listListeners.listCleared(this);
>
> // Add the new files, firing an insert event for each file
> if (fileList != null) {
> in this case, the warning tells that if (fileList != null) is
> unnecessary, because in case of null we get a NPE in the line
> containing fileList.length . So maybe a better check is to move over
> the null check and set a length value to zero in that case.
Hmm - I'm not sure if we should throw if fileList is null, because that
signals some error condition in listRoots() or listFiles(). Either that, or
we should set files to a new list of length zero. Greg?
> Dead local store:
> TerraPanoramaSkin.java:383 Dead store to scrollLeft
> TerraPanoramaSkin.java:376 Dead store to scrollTop
> TerraActivityIndicatorSkin.java:87 Dead store to increment
> Drawing.java:59 Dead store to bounds
Hold off on these changes, as they should be investigated further.
Version.java:104 Equals method for org.apache.pivot.util.Version
> assumes the argument is of type Version
Can you add an instanceof check?
> Non-serializable value stored into instance field of a serializable class
> ApplicationContext.java:97
> org.apache.pivot.wtk.ApplicationContext$DisplayHost$1 stored into
> non-transient field ApplicationContext$DisplayHost.dropTargetListener
> ApplicationContext.java:957 org.apache.pivot.wtk.LocalManifest stored
> into non-transient field ApplicationContext$DisplayHost.dragManifest
> Solution: make the variable transient.
Ok, you can make those transient.
> Non-transient non-serializable instance field in serializable class
> ArrayQueue.java:33 Class org.apache.pivot.collections.ArrayQueue
> defines non-transient non-serializable instance field queueListeners
> LinkedStack.java:31 Class org.apache.pivot.collections.LinkedStack
> defines non-transient non-serializable instance field stackListeners
> ArrayStack.java:33 Class org.apache.pivot.collections.ArrayStack
> defines non-transient non-serializable instance field stackListeners
> LinkedQueue.java:31 Class org.apache.pivot.collections.LinkedQueue
> defines non-transient non-serializable instance field queueListeners
> Solution: make the variable transient.
Yes, you can make those fields transient.
> Serializable inner class
> LinkedList.java:37 org.apache.pivot.collections.LinkedList$Node is
> serializable and an inner class
> Solution: make the inner class static.
Yes, you can make Node a static inner class.
> Should be a static inner class
> MenuButton.java:36 Should
> org.apache.pivot.wtk.MenuButton$MenuButtonListenerList be a _static_
> inner class?
> Element.java:81 Should
> org.apache.pivot.wtk.text.Element$ElementListenerList be a _static_
> inner class?
> ChartView.java:327 Should
> org.apache.pivot.charts.ChartView$ChartViewSeriesListenerList be a
> _static_ inner class?
> Menu.java:41 Should org.apache.pivot.wtk.Menu$Item$ItemListenerList be
> a _static_ inner class?
> TerraCalendarSkin.java:343 Should
> org.apache.pivot.wtk.skin.terra.TerraCalendarSkin$DateButtonDataRenderer
> be a _static_ inner class?
> ChartView.java:297 Should
> org.apache.pivot.charts.ChartView$ChartViewCategoryListenerList be a
> _static_ inner class?
> ChartView.java:255 Should
> org.apache.pivot.charts.ChartView$ChartViewListenerList be a _static_
> inner class?
> MenuBar.java:40 Should
> org.apache.pivot.wtk.MenuBar$Item$ItemListenerList be a _static_ inner
> class?
> MenuBar.java:191 Should
> org.apache.pivot.wtk.MenuBar$MenuBarListenerList be a _static_ inner
> class?
> Canvas.java:36 Should
> org.apache.pivot.wtk.media.drawing.Canvas$CanvasListenerList be a
> _static_ inner class?
> MenuPopup.java:27 Should
> org.apache.pivot.wtk.MenuPopup$MenuPopupListenerList be a _static_
> inner class?
> TextNode.java:27 Should
> org.apache.pivot.wtk.text.TextNode$TextNodeListenerList be a _static_
> inner class?
Those can all be static inner classes - can you make this change?
> Unchecked/unconfirmed cast
> TerraPromptSkin.java:133 Unchecked/unconfirmed cast from
> org.apache.pivot.wtk.Window to org.apache.pivot.wtk.Prompt
> ShutdownTest.java:52 Unchecked/unconfirmed cast from
> org.apache.pivot.wtk.Dialog to org.apache.pivot.wtk.Alert
> TerraAlertSkin.java:135 Unchecked/unconfirmed cast from
> org.apache.pivot.wtk.Window to org.apache.pivot.wtk.Alert
> Solution: check with generics, or at least with instanceof .
These are false positives - they may be ignored.
> ApplicationContext.java:384 Method
> org.apache.pivot.wtk.ApplicationContext$DisplayHost.paint(Graphics)
> uses the nextDouble method of Random to generate a random integer;
> using nextInt is more efficient
> ApplicationContext.java:383 Method
> org.apache.pivot.wtk.ApplicationContext$DisplayHost.paint(Graphics)
> uses the nextDouble method of Random to generate a random integer;
> using nextInt is more efficient
Wow - I didn't even know of the existence of Random.nextInt(int). Can you
make this change as well?
Thanks Sandro,
-T