You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Sandro Martini <sa...@gmail.com> on 2009/11/17 15:08:48 UTC

Small things (by Findbugs)

Hi, 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