Hi to all,
some other small (easy) things to fix, grouped by bug/suggestion type:
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
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.
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
Version.java:104 Equals method for org.apache.pivot.util.Version
assumes the argument is of type Version
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.
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.
Serializable inner class
LinkedList.java:37 org.apache.pivot.collections.LinkedList$Node is
serializable and an inner class
Solution: make the inner class static.
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?
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 .
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
This is only the (long) index.
Tell me if i can do the patch, and optional if not on some sources ...
or if you prefer the patch sources here before to apply.
Next, there are other categories, but not so much :-) .
My plan for the 1.3 release is to have as much as things fixed.
Bye