[Japi-cvs] SF.net SVN: japi:[747] tools
Status: Beta
Brought to you by:
christianhujer
|
From: <chr...@us...> - 2008-12-27 22:06:31
|
Revision: 747
http://japi.svn.sourceforge.net/japi/?rev=747&view=rev
Author: christianhujer
Date: 2008-12-27 21:40:37 +0000 (Sat, 27 Dec 2008)
Log Message:
-----------
Code improvements regarding @Nullable / @NotNull, if vs. ?:.
Modified Paths:
--------------
historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
historic/trunk/src/app/net/sf/japi/io/ARGVEnumeration.java
historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java
historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java
historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java
historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java
historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java
historic/trunk/src/test/net/sf/japi/util/PairTest.java
historic/trunk/src/test/net/sf/japi/util/TableTest.java
libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
libs/argparser/trunk/src/prj/net/sf/japi/io/args/CommandWithHelp.java
libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/OututStreamConverter.java
libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java
libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java
libs/swing-action/trunk/src/tst/test/net/sf/japi/swing/ReflectionActionTest.java
libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java
libs/swing-bookmarks/trunk/src/prj/net/sf/japi/swing/bookmarks/BookmarkManager.java
libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java
libs/swing-font/trunk/src/prj/net/sf/japi/swing/font/FontChooser.java
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/ConsoleProgress.java
libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JSAXErrorHandler.java
libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java
libs/util/trunk/src/prj/net/sf/japi/util/Collections2.java
libs/util/trunk/src/prj/net/sf/japi/util/filter/file/EndingFileFilter.java
libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java
libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIteratorTest.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java
progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/OpenURLPane.java
progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java
tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java
tools/cstyle/trunk/src/prj/net/sf/japi/cstyle/LineEndingParser.java
tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java
tools/string2bytes/trunk/src/tst/test/net/sf/japi/string2bytes/CodecStepTest.java
Modified: historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/app/net/sf/japi/finance/SimpleCapitalCalculator.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -45,11 +45,7 @@
if ( numberOfPeriods < 0 ) throw new IllegalArgumentException("Number of periods has to be at least 0!");
if ( numberOfPeriods == 0 )
return initialCapital;
- if( numberOfPeriods == 1 ) {
- currentCapital = initialCapital * (1 + interestRate/100);
- } else {
- currentCapital = initialCapital * Math.pow(( 1 + interestRate/100 ), numberOfPeriods);
- }
+ currentCapital = numberOfPeriods == 1 ? initialCapital * (1 + interestRate / 100) : initialCapital * Math.pow((1 + interestRate / 100), numberOfPeriods);
return currentCapital;
}
@@ -93,7 +89,7 @@
public String toString() {
return "initial capital: " + this.initialCapital +
"\ninterest rate: " + this.interestRate +
- "\ncurrent capital: " + this.currentCapital;
+ "\ncurrent capital: " + this.currentCapital;
}
/** Clones the current SimpleCapitalCalculator.
@@ -106,5 +102,5 @@
throw new InternalError();
}
}
-
+
} // class SimpleCapitalCalculator
Modified: historic/trunk/src/app/net/sf/japi/io/ARGVEnumeration.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/io/ARGVEnumeration.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/app/net/sf/japi/io/ARGVEnumeration.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -30,6 +30,7 @@
import java.util.List;
import java.util.NoSuchElementException;
import net.sf.japi.util.ThrowableHandler;
+import org.jetbrains.annotations.Nullable;
/** Implementation of {@link Enumeration} for ARGV.
* Used by {@link ARGVInputStream} and {@link ARGVReader}.
@@ -50,7 +51,7 @@
private InputStream currentStream;
/** Next InputStream. */
- private InputStream nextStream;
+ @Nullable private InputStream nextStream;
/** Current filename. */
private String currentFilename;
Modified: historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/app/net/sf/japi/sql/CachedResultSetTableModel.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -58,15 +58,15 @@
/** The column titles.
* @serial include
*/
- private String[] columnTitles;
+ @Nullable private String[] columnTitles;
/** The Data.
* @serial include
*/
- private Object[][] data;
+ @Nullable private Object[][] data;
/** The ResultSet. */
- private ResultSet resultSet;
+ @Nullable private ResultSet resultSet;
/** Create a CachedResultSetTableModel. */
public CachedResultSetTableModel() {
@@ -75,7 +75,7 @@
/** Create a CachedResultSetTableModel.
* @param rs Initial ResultSet
*/
- public CachedResultSetTableModel(final ResultSet rs) {
+ public CachedResultSetTableModel(@Nullable final ResultSet rs) {
setResultSet(rs);
}
@@ -93,7 +93,7 @@
}
/** {@inheritDoc} */
- public void setResultSet(final ResultSet resultSet) {
+ public void setResultSet(@Nullable final ResultSet resultSet) {
if (resultSet == null) {
this.resultSet = resultSet;
rowCount = 0;
@@ -120,7 +120,7 @@
}
/** {@inheritDoc} */
- public ResultSet getResultSet() {
+ @Nullable public ResultSet getResultSet() {
return resultSet;
}
Modified: historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/app/net/sf/japi/sql/DatabaseTreeModel.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -30,6 +30,7 @@
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
+import org.jetbrains.annotations.Nullable;
/** A TreeModel displaying the catalogs of a database (usually tables and views) as tree.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
@@ -67,7 +68,7 @@
public void refresh() throws SQLException {
catalogs.clear();
if (databaseMetaData != null) {
- ResultSet rs = null;
+ @Nullable ResultSet rs = null;
try {
rs = databaseMetaData.getCatalogs();
while (rs.next()) {
@@ -118,20 +119,12 @@
/** {@inheritDoc} */
public int getChildCount(final Object parent) {
- if (parent == this) {
- return catalogs.size();
- } else {
- return ((CatalogTreeNode) parent).getTableCount();
- }
+ return parent == this ? catalogs.size() : ((CatalogTreeNode) parent).getTableCount();
}
/** {@inheritDoc} */
public int getIndexOfChild(final Object parent, final Object child) {
- if (parent == this) {
- return catalogs.indexOf(child);
- } else {
- return ((CatalogTreeNode) parent).getTableIndex((CatalogTreeNode.TableTreeNode) child);
- }
+ return parent == this ? catalogs.indexOf(child) : ((CatalogTreeNode) parent).getTableIndex((CatalogTreeNode.TableTreeNode) child);
}
/** {@inheritDoc} */
@@ -181,7 +174,7 @@
*/
CatalogTreeNode(final String catalog) throws SQLException {
this.catalog = catalog;
- ResultSet rs = null;
+ @Nullable ResultSet rs = null;
try {
rs = databaseMetaData.getTables(catalog, null, null, null);
while (rs.next()) {
Modified: historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/app/net/sf/japi/sql/ScrollResultSetTableModel.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -74,7 +74,7 @@
/** The column titles.
* @serial include
*/
- private String[] columnTitles;
+ @Nullable private String[] columnTitles;
/** Create a ResultSetTableModel. */
public ScrollResultSetTableModel() {
@@ -161,11 +161,7 @@
return 0;
}
try {
- if (resultSet.last()) {
- return resultSet.getRow();
- } else {
- return 0;
- }
+ return resultSet.last() ? resultSet.getRow() : 0;
} catch (final SQLException e) {
handleException(e);
return 0;
Modified: historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java
===================================================================
--- historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/app/net/sf/japi/swing/JPropertyEditor.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -71,12 +71,7 @@
propertyEditor = PropertyEditorManager.findEditor(propertyType);
}
if (propertyEditor != null) {
- final Component editor;
- if (propertyEditor.supportsCustomEditor()) {
- editor = propertyEditor.getCustomEditor();
- } else {
- editor = createEditor(propertyType);
- }
+ final Component editor = propertyEditor.supportsCustomEditor() ? propertyEditor.getCustomEditor() : createEditor(propertyType);
if (editor != null) {
//noinspection ObjectAllocationInLoop
add(new JLabel(propertyName), labelGbc);
Modified: historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java
===================================================================
--- historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/doc/guide/swing/action/fromScratch/src/net/sf/japi/examples/editor/Editor.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -48,7 +48,7 @@
/** Currently opened file.
* Maybe <code>null</code> in case the current document was not already saved.
*/
- private File file;
+ @Nullable private File file;
/** Create the Editor. */
public Editor() {
Modified: historic/trunk/src/test/net/sf/japi/util/PairTest.java
===================================================================
--- historic/trunk/src/test/net/sf/japi/util/PairTest.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/test/net/sf/japi/util/PairTest.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -23,6 +23,7 @@
import junit.framework.TestCase;
import net.sf.japi.util.Pair;
+import org.jetbrains.annotations.Nullable;
/** Test class for {@link Pair}.
* @author <a href="mailto:ch...@it...">Christian Hujer</a>
@@ -30,9 +31,9 @@
public class PairTest extends TestCase {
/** Object Under Test: A Table. */
- private Pair<Object,Object> oUT;
- private String first;
- private String second;
+ @Nullable private Pair<Object,Object> oUT;
+ @Nullable private String first;
+ @Nullable private String second;
/** {@inheritDoc} */
@Override protected void setUp() throws Exception {
Modified: historic/trunk/src/test/net/sf/japi/util/TableTest.java
===================================================================
--- historic/trunk/src/test/net/sf/japi/util/TableTest.java 2008-12-27 03:27:49 UTC (rev 746)
+++ historic/trunk/src/test/net/sf/japi/util/TableTest.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -24,6 +24,7 @@
import junit.framework.TestCase;
import net.sf.japi.util.Pair;
import net.sf.japi.util.Table;
+import org.jetbrains.annotations.Nullable;
/** Test class for Table.
* @author <a href="mailto:ch...@it...">Christian Hujer</a>
@@ -31,7 +32,7 @@
public class TableTest extends TestCase {
/** Object Under Test: A Table. */
- private Table<Object,Object> oUT;
+ @Nullable private Table<Object,Object> oUT;
/** {@inheritDoc} */
@Override public void setUp() throws Exception {
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/ArgParser.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -111,7 +111,7 @@
final List<String> argList = new ArrayList<String>(args);
for (final ListIterator<String> iterator = argList.listIterator(); iterator.hasNext();) {
final String arg = iterator.next();
- if (arg.equals("--")) {
+ if ("--".equals(arg)) {
break;
}
if (arg.startsWith("@")) {
@@ -186,7 +186,7 @@
// But it's safer to check this.
throw new NullPointerException("null is not allowed for an option name.");
}
- if (optionName.equals("")) {
+ if ("".equals(optionName)) {
throw new IllegalArgumentException("The empty String is not allowed as option name.");
}
if (optionName.startsWith("-")) {
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/CommandWithHelp.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/CommandWithHelp.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/CommandWithHelp.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -70,7 +70,7 @@
final String delim = shortNames.size() > 0 && longNames.size() > 0 ? ", " : " ";
String description;
try {
- final String optionKey = option.key().equals("") ? optionMethod.getName() : option.key();
+ final String optionKey = "".equals(option.key()) ? optionMethod.getName() : option.key();
description = getString(optionKey);
} catch (final MissingResourceException ignore) {
description = "";
Modified: libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/OututStreamConverter.java
===================================================================
--- libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/OututStreamConverter.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/argparser/trunk/src/prj/net/sf/japi/io/args/converter/OututStreamConverter.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -43,11 +43,7 @@
/** {@inheritDoc} */
@NotNull public OutputStream convert(@NotNull final Locale locale, @NotNull final String arg) throws FileNotFoundException {
- if ("-".equals(arg) && !new File("-").exists()) {
- return System.out;
- } else {
- return new FileOutputStream(arg);
- }
+ return "-".equals(arg) && !new File("-").exists() ? System.out : new FileOutputStream(arg);
}
} // class InputStreamConverter
Modified: libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java
===================================================================
--- libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/lang/trunk/src/prj/net/sf/japi/lang/PropertyComparator.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -66,11 +66,7 @@
final Method o2Getter = getter != null ? getter : getPropertyGetter(o2.getClass(), propertyName);
final Object o1Value = o1Getter.invoke(o1);
final Object o2Value = o2Getter.invoke(o2);
- if (delegate == null) {
- return ((Comparable) o1Value).compareTo((Comparable) o2Value);
- } else {
- return delegate.compare((T) o1Value, (T) o2Value);
- }
+ return delegate == null ? ((Comparable) o1Value).compareTo((Comparable) o2Value) : delegate.compare((T) o1Value, (T) o2Value);
} catch (final IllegalAccessException e) {
throw new IllegalAccessError(e.getMessage());
} catch (final InvocationTargetException e) {
Modified: libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java
===================================================================
--- libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/midi/trunk/src/prj/net/sf/japi/midi/gui/SpinnerChannelModel.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -1,6 +1,6 @@
package net.sf.japi.midi.gui;
-import javax.swing.AbstractSpinnerModel;
+import javax.swing.AbstractSpinnerModel;import org.jetbrains.annotations.Nullable;
/** A SpinnerModel for MIDI Channels.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
@@ -31,12 +31,12 @@
}
/** {@inheritDoc} */
- public Object getNextValue() {
+ @Nullable public Object getNextValue() {
return value < 0xF ? value + 1 : null;
}
/** {@inheritDoc} */
- public Object getPreviousValue() {
+ @Nullable public Object getPreviousValue() {
return value > 0x0 ? value - 1 : null;
}
}
Modified: libs/swing-action/trunk/src/tst/test/net/sf/japi/swing/ReflectionActionTest.java
===================================================================
--- libs/swing-action/trunk/src/tst/test/net/sf/japi/swing/ReflectionActionTest.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/swing-action/trunk/src/tst/test/net/sf/japi/swing/ReflectionActionTest.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -25,6 +25,7 @@
import net.sf.japi.swing.ActionBuilderFactory;
import net.sf.japi.swing.ActionMethod;
import net.sf.japi.swing.ReflectionAction;
+import org.jetbrains.annotations.Nullable;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -41,7 +42,7 @@
private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("test.net.sf.japi.swing");
/** The testling: A ReflectionAction. */
- private ReflectionAction testling;
+ @Nullable private ReflectionAction testling;
/** The Action Mock. */
private ActionMock actionMock;
Modified: libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java
===================================================================
--- libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/swing-app/trunk/src/prj/net/sf/japi/swing/app/Application.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -408,11 +408,7 @@
*/
private void setActiveDocumentImpl(@Nullable final DocumentFrame<D> docFrame) {
currentDocumentFrame = docFrame;
- if (docFrame != null) {
- currentDocument = docFrame.getDocument();
- } else {
- currentDocument = null;
- }
+ currentDocument = docFrame != null ? docFrame.getDocument() : null;
updateActionStates();
}
Modified: libs/swing-bookmarks/trunk/src/prj/net/sf/japi/swing/bookmarks/BookmarkManager.java
===================================================================
--- libs/swing-bookmarks/trunk/src/prj/net/sf/japi/swing/bookmarks/BookmarkManager.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/swing-bookmarks/trunk/src/prj/net/sf/japi/swing/bookmarks/BookmarkManager.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -53,6 +53,7 @@
import net.sf.japi.swing.IconManager;
import net.sf.japi.util.EmptyEnumeration;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.w3c.dom.DOMImplementation;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -294,7 +295,7 @@
/** The folder (parent) of this bookmark.
* @serial include
*/
- private BookmarkFolder folder;
+ @Nullable private BookmarkFolder folder;
///** Create a Bookmark without title.
// * Should only be used by {@link BookmarkFolder#BookmarkFolder()}.
@@ -321,14 +322,14 @@
/** Get the folder (parent) of this bookmark.
* @return folder (parent) of this bookmark
*/
- public BookmarkFolder getFolder() {
+ @Nullable public BookmarkFolder getFolder() {
return folder;
}
/** Set the folder (parent) of this bookmark.
* @param folder parent folder of this bookmark
*/
- public void setFolder(final BookmarkFolder folder) {
+ public void setFolder(@Nullable final BookmarkFolder folder) {
if (this.folder != null) {
this.folder.remove(this);
}
Modified: libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java
===================================================================
--- libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/swing-extlib/trunk/src/prj/net/sf/japi/swing/ToolBarLayout.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -30,6 +30,7 @@
import java.util.ArrayList;
import java.util.List;
import javax.swing.JToolBar;
+import org.jetbrains.annotations.Nullable;
/** A LayoutManager that manages a layout of a {@link Container} similar to {@link BorderLayout} but with an important difference, it is possible to
* add as many components to a side layout region as you want. The desired purpose is to serve as LayoutManager for containers that shall contain
@@ -109,7 +110,7 @@
/** Component in the center region.
* @serial include
*/
- private Component center;
+ @Nullable private Component center;
/** Create a ToolBarLayout with zero gaps. */
public ToolBarLayout() {
Modified: libs/swing-font/trunk/src/prj/net/sf/japi/swing/font/FontChooser.java
===================================================================
--- libs/swing-font/trunk/src/prj/net/sf/japi/swing/font/FontChooser.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/swing-font/trunk/src/prj/net/sf/japi/swing/font/FontChooser.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -211,11 +211,7 @@
@Nullable public static Font showChooseFontDialog(@Nullable final Component parent, @Nullable final Font font) {
final FontChooser chooser = new FontChooser();
chooser.setSelectedFont(font);
- if (showConfirmDialog(parent, chooser, ACTION_BUILDER.getString("chooser.title"), OK_CANCEL_OPTION, PLAIN_MESSAGE) == OK_OPTION) {
- return chooser.selectedFont;
- } else {
- return null;
- }
+ return showConfirmDialog(parent, chooser, ACTION_BUILDER.getString("chooser.title"), OK_CANCEL_OPTION, PLAIN_MESSAGE) == OK_OPTION ? chooser.selectedFont : null;
}
} // class FontChooser
Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/ConsoleProgress.java
===================================================================
--- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/ConsoleProgress.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/ConsoleProgress.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -16,10 +16,10 @@
private final Appendable out;
/** The flushable for out. */
- private final Flushable flushOut;
+ @Nullable private final Flushable flushOut;
/** The closeable for out. */
- private final Closeable closeOut;
+ @Nullable private final Closeable closeOut;
/** Current maximum. */
private int max;
Modified: libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JSAXErrorHandler.java
===================================================================
--- libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JSAXErrorHandler.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/swing-misc/trunk/src/prj/net/sf/japi/swing/misc/JSAXErrorHandler.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -27,6 +27,7 @@
import javax.swing.JTextArea;
import net.sf.japi.swing.ActionBuilder;
import net.sf.japi.swing.ActionBuilderFactory;
+import org.jetbrains.annotations.Nullable;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
@@ -48,7 +49,7 @@
/** The Dialog.
* @serial include
*/
- private JDialog dialog;
+ @Nullable private JDialog dialog;
/** Parent component.
* @serial include
Modified: libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java
===================================================================
--- libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/taglets/trunk/src/prj/net/sf/japi/taglets/BlockListTaglet.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -21,7 +21,7 @@
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.Taglet;
-import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.NotNull;import org.jetbrains.annotations.Nullable;
/**
* Base class for Taglets that are simple blocks transforming into lists.
@@ -114,7 +114,7 @@
}
/** {@inheritDoc} */
- public String toString(final Tag[] tags) {
+ @Nullable public String toString(final Tag[] tags) {
if (tags == null || tags.length == 0) {
return null;
}
Modified: libs/util/trunk/src/prj/net/sf/japi/util/Collections2.java
===================================================================
--- libs/util/trunk/src/prj/net/sf/japi/util/Collections2.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/util/trunk/src/prj/net/sf/japi/util/Collections2.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -64,7 +64,7 @@
* @return collection containing only those elements accepted by the filter or <code>null</code> if the Collection could not be created.
*/
@Nullable public static <T, C extends Collection<T>> C filter(@NotNull final C c, @NotNull final Filter<? super T> filter) {
- C filtered = null;
+ @Nullable C filtered = null;
try {
filtered = (C) c.getClass().newInstance();
} catch (final Exception e) { /* ignore, check is done on null. */ }
Modified: libs/util/trunk/src/prj/net/sf/japi/util/filter/file/EndingFileFilter.java
===================================================================
--- libs/util/trunk/src/prj/net/sf/japi/util/filter/file/EndingFileFilter.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/util/trunk/src/prj/net/sf/japi/util/filter/file/EndingFileFilter.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -86,6 +86,7 @@
ret |= fileName.endsWith(ending);
}
}
+ ret = acceptDirectories ? pathname.isDirectory() : !pathname.isDirectory();
if (acceptDirectories) {
ret |= pathname.isDirectory();
} else {
Modified: libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java
===================================================================
--- libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIterator2Test.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -25,6 +25,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import net.sf.japi.xml.NodeListIterator;
+import org.jetbrains.annotations.Nullable;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -39,7 +40,7 @@
public class NodeListIterator2Test {
/** Object Under Test: A NodeListIterator. */
- private NodeListIterator<Node> testling;
+ @Nullable private NodeListIterator<Node> testling;
/** Mock NodeList. */
private NodeList mockNodeList;
Modified: libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIteratorTest.java
===================================================================
--- libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIteratorTest.java 2008-12-27 03:27:49 UTC (rev 746)
+++ libs/xml/trunk/src/tst/test/net/sf/japi/xml/NodeListIteratorTest.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -7,6 +7,7 @@
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import net.sf.japi.xml.NodeListIterator;
+import org.jetbrains.annotations.Nullable;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
@@ -25,7 +26,7 @@
public class NodeListIteratorTest {
/** The DocumentBuilder for creating DOM trees for testing. */
- private static DocumentBuilder db;
+ @Nullable private static DocumentBuilder db;
/** Creates the DocumentBuilder that is used for creating DOM trees for testing.
* @throws ParserConfigurationException (unexpected)
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java 2008-12-27 03:27:49 UTC (rev 746)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/jtest/gui/ProgramFrame.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -59,6 +59,7 @@
import net.sf.japi.swing.prefs.PreferencesPane;
import net.sf.japi.swing.recent.RecentURLsMenu;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/** Programmfenster.
* @author $Author: chris $
@@ -99,7 +100,7 @@
/** The URL of the current question collection.
* @serial include
*/
- private String url;
+ @Nullable private String url;
/** Create a ProgramFrame.
* @param program Program object to create frame for
@@ -195,7 +196,7 @@
/** Get the URL to display.
* @return diplayed URL
*/
- public String getURL() {
+ @Nullable public String getURL() {
try {
URL url = new URL(this.url);
final int index = questionCollectionGUI.getIndex();
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java 2008-12-27 03:27:49 UTC (rev 746)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/AbstractManager.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -20,14 +20,16 @@
package net.sf.japi.progs.jeduca.swing;
-import java.awt.Component;import java.awt.Container;
+import java.awt.Component;
+import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
-import java.util.List;import java.util.Collection;
+import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.AbstractButton;
import javax.swing.Action;
@@ -42,6 +44,7 @@
import javax.swing.JToolBar;
import net.sf.japi.swing.ActionBuilder;
import net.sf.japi.swing.ActionBuilderFactory;
+import org.jetbrains.annotations.Nullable;
/** Base class for Manager classes that manage visibility of components and provide corresponding menus.
* <p />
@@ -148,7 +151,7 @@
* @param comp component to find Action for
* @return SubAction for the specified comp.
*/
- private Action findActionFor(final T comp) {
+ @Nullable private Action findActionFor(final T comp) {
for (final SubAction<?> action : actions) {
if (action.getComponent() == comp) {
return action;
@@ -189,7 +192,7 @@
* The default implementation returns <code>null</code>, you might want to override this method.
* @return Configure Action
*/
- protected Action getConfigureAction() {
+ @Nullable protected Action getConfigureAction() {
return null;
}
Modified: progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/OpenURLPane.java
===================================================================
--- progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/OpenURLPane.java 2008-12-27 03:27:49 UTC (rev 746)
+++ progs/jeduca/trunk/src/prj/net/sf/japi/progs/jeduca/swing/OpenURLPane.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -44,6 +44,7 @@
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import net.sf.japi.swing.ActionBuilderFactory;
+import org.jetbrains.annotations.Nullable;
/** Class for displaying a Dialog which requests that the user enters a URL or opens a File selection box.
* It works quite like {@link JFileChooser}, even a bit simpler.
@@ -136,7 +137,7 @@
/** Dialog to show.
* @serial include
*/
- private JDialog dialog;
+ @Nullable private JDialog dialog;
/** JFileChooser to use.
* @serial include
@@ -146,7 +147,7 @@
/** String with result of user selection / input.
* @serial include
*/
- private String result;
+ @Nullable private String result;
/** Show a dialog using a default JFileChooser.
* @param parent Parent component
@@ -201,12 +202,12 @@
}
/** Frame if now owner frame. */
- private static Frame rootFrame;
+ @Nullable private static Frame rootFrame;
/** Get the root frame to use if there is no owner frame.
* @return frame
*/
- private static synchronized Window getRootFrame() {
+ @Nullable private static synchronized Window getRootFrame() {
if (rootFrame == null) {
rootFrame = new JFrame();
}
Modified: progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java
===================================================================
--- progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java 2008-12-27 03:27:49 UTC (rev 746)
+++ progs/jtype/trunk/src/prj/net/sf/japi/jtype/ReflectionField.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -6,7 +6,7 @@
import java.lang.reflect.InvocationTargetException;
import java.awt.GridBagLayout;
import java.util.Locale;
-import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.NotNull;import org.jetbrains.annotations.Nullable;
/** A component that displays a property value along with a label.
* It uses reflection to get the object's value.
@@ -60,7 +60,7 @@
* @param propertyName Name of the property for which the getter method shall be returned.
* @return The getter method for the specified property of the specified class or <code>null</code> if such a getter method cannot be returned.
*/
- private static Method getGetterMethod(@NotNull final Class<?> clazz, @NotNull final String propertyName) {
+ @Nullable private static Method getGetterMethod(@NotNull final Class<?> clazz, @NotNull final String propertyName) {
final String capName = propertyName.substring(0, 1).toUpperCase(Locale.ENGLISH) + propertyName.substring(1);
try {
return clazz.getMethod("get" + capName);
Modified: tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java
===================================================================
--- tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java 2008-12-27 03:27:49 UTC (rev 746)
+++ tools/archStat/trunk/src/prj/net/sf/japi/archstat/FileStat.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -1,13 +1,14 @@
package net.sf.japi.archstat;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.HashMap;
-import java.util.ArrayList;
import java.util.TreeSet;
-import java.io.File;
-import java.io.IOException;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/** Per-File statistics.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
@@ -30,7 +31,7 @@
private final String title;
/** The file (regular file or directory) of this statistic. */
- private final File file;
+ @Nullable private final File file;
private int linesRaw;
Modified: tools/cstyle/trunk/src/prj/net/sf/japi/cstyle/LineEndingParser.java
===================================================================
--- tools/cstyle/trunk/src/prj/net/sf/japi/cstyle/LineEndingParser.java 2008-12-27 03:27:49 UTC (rev 746)
+++ tools/cstyle/trunk/src/prj/net/sf/japi/cstyle/LineEndingParser.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -20,6 +20,7 @@
package net.sf.japi.cstyle;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/** A LineEndingParser can verify whether a file has the correct line ending.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
@@ -41,7 +42,7 @@
/** {@inheritDoc} */
public void process(final char b) {
final boolean lineFeed = b == ASCII_LF;
- final NewLine newLineFound;
+ @Nullable final NewLine newLineFound;
newLineFound = lineFeed
? carriageReturn ? NewLine.DOS : NewLine.UNIX
: carriageReturn ? NewLine.MAC : null;
Modified: tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java
===================================================================
--- tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java 2008-12-27 03:27:49 UTC (rev 746)
+++ tools/gdbControl/trunk/src/prj/net/sf/japi/tools/gdbcontrol/ComWithGdb.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -6,6 +6,7 @@
import java.io.InputStream;
import java.io.OutputStream;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/** A Java wrapper for communication with gdb.
* @author <a href="mailto:ch...@ri...">Christian Hujer</a>
@@ -17,7 +18,7 @@
private final CharSequence prompt = "(gdb) ";
/** The process of gdb. */
- private Process gdbProcess;
+ @Nullable private Process gdbProcess;
/** InputStream to read data from gdb's stdout. */
private InputStream gdbIn;
Modified: tools/string2bytes/trunk/src/tst/test/net/sf/japi/string2bytes/CodecStepTest.java
===================================================================
--- tools/string2bytes/trunk/src/tst/test/net/sf/japi/string2bytes/CodecStepTest.java 2008-12-27 03:27:49 UTC (rev 746)
+++ tools/string2bytes/trunk/src/tst/test/net/sf/japi/string2bytes/CodecStepTest.java 2008-12-27 21:40:37 UTC (rev 747)
@@ -23,6 +23,7 @@
import net.sf.japi.string2bytes.EntityCodec;
import net.sf.japi.string2bytes.IdentityCodec;
import net.sf.japi.string2bytes.StringCodec;
+import org.jetbrains.annotations.Nullable;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -36,13 +37,13 @@
public class CodecStepTest {
/** The CodecStep to test. */
- private CodecStep codecStep;
+ @Nullable private CodecStep codecStep;
/** The Codec to use for most tests. */
- private StringCodec codec;
+ @Nullable private StringCodec codec;
/** The Charset to use for most tests. */
- private String charset;
+ @Nullable private String charset;
/**
* Creates the test data and a testling.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|