pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sandro Martini <sandro.mart...@gmail.com>
Subject Little things (by FindBugs)
Date Tue, 01 Dec 2009 09:19:08 GMT
Hi, with the help on FindBugs I found some little things to fix:

- LabelSkin.java:184 Dead store to textHeight
       float textHeight = lm.getHeight();

       if (wrapText) {
           textHeight = Math.max(getPreferredHeight(width) -
(padding.top + padding.bottom), 0);
       } else {
           textHeight = (int)Math.ceil(lm.getHeight());
       }

 textHeight is always set, so we could avoid to assign a value to it
in the definition.
But the dead store warning is a false positive.

- TerraTextInputSkin.java:206 integral value cast to double and then
passed to Math.ceil

- Comparator implements Comparator but not Serializable (sorry, maybe
some of them could be already in a previous warning)
TreeView.java:610 org.apache.pivot.wtk.TreeView$PathComparator
implements Comparator but not Serializable
TreeNodeComparator.java:1
org.apache.pivot.tutorials.TreeNodeComparator implements Comparator
but not Serializable
ComponentPropertyInspectorSkin.java:38
org.apache.pivot.tools.wtk.ComponentPropertyInspectorSkin$ClassComparator
implements Comparator but not Serializable
ComponentPropertyInspectorSkin.java:31
org.apache.pivot.tools.wtk.ComponentPropertyInspectorSkin$NameComparator
implements Comparator but not Serializable
EventLoggerSkin.java:44
org.apache.pivot.tools.wtk.EventLoggerSkin$TreeNodeComparator
implements Comparator but not Serializable
TerraFileBrowserSkin.java:406
org.apache.pivot.wtk.skin.terra.TerraFileBrowserSkin$FileComparator
implements Comparator but not Serializable

- BrowserApplicationContext.java:40 Class
org.apache.pivot.wtk.BrowserApplicationContext$HostApplet defines
non-transient non-serializable instance field applicationContext

- 16 warnings on this type: TerraPaletteSkin.java:361 integral
division result cast to double or float
With a little change like this we can solve the warning:
original (current):
       graphics.setPaint(new GradientPaint(width / 2, 0, titleBarBevelColor,
           width / 2, titleBarHeight + 1, titleBarBackgroundColor));
modified:
       graphics.setPaint(new GradientPaint(width / 2f, 0f, titleBarBevelColor,
           width / 2f, titleBarHeight + 1, titleBarBackgroundColor));


- ValueSeries.java:1 org.apache.pivot.charts.content.ValueSeries
doesn't override org.apache.pivot.collections.ArrayList.equals(Object)
TreeView.java:633 org.apache.pivot.wtk.TreeView$BranchHandler doesn't
override org.apache.pivot.collections.ArrayList.equals(Object)


- then there are others, but i think we can leave them as currently ...


Tell me,
Sandro

Mime
View raw message