You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2018/06/04 15:45:49 UTC

svn commit: r1832861 - in /pivot/trunk: ./ core/src/org/apache/pivot/beans/ core/src/org/apache/pivot/collections/adapter/ core/src/org/apache/pivot/json/ core/src/org/apache/pivot/util/ wtk/src/org/apache/pivot/wtk/

Author: rwhitcomb
Date: Mon Jun  4 15:45:49 2018
New Revision: 1832861

URL: http://svn.apache.org/viewvc?rev=1832861&view=rev
Log:
PIVOT-1032:  Working on the style errors.

Modified:
    pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java
    pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java
    pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java
    pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
    pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java
    pivot/trunk/core/src/org/apache/pivot/util/Vote.java
    pivot/trunk/core/src/org/apache/pivot/util/VoteResult.java
    pivot/trunk/pivot_checks.xml
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java

Modified: pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/beans/BeanAdapter.java Mon Jun  4 15:45:49 2018
@@ -29,6 +29,7 @@ import java.util.Iterator;
 import java.util.Locale;
 import java.util.NoSuchElementException;
 
+import org.apache.pivot.annotations.UnsupportedOperation;
 import org.apache.pivot.collections.Map;
 import org.apache.pivot.collections.MapListener;
 import org.apache.pivot.util.ListenerList;
@@ -139,6 +140,7 @@ public class BeanAdapter implements Map<
         }
 
         @Override
+        @UnsupportedOperation
         public void remove() {
             throw new UnsupportedOperationException();
         }
@@ -155,15 +157,17 @@ public class BeanAdapter implements Map<
 
     private static final String ENUM_VALUE_OF_METHOD_NAME = "valueOf";
 
-    private static final String ILLEGAL_ACCESS_EXCEPTION_MESSAGE_FORMAT = "Unable to access property \"%s\" for type %s.";
-    private static final String ENUM_COERCION_EXCEPTION_MESSAGE = "Unable to coerce %s (\"%s\") to %s.\nValid enum constants - %s";
+    private static final String ILLEGAL_ACCESS_EXCEPTION_MESSAGE_FORMAT =
+            "Unable to access property \"%s\" for type %s.";
+    private static final String ENUM_COERCION_EXCEPTION_MESSAGE =
+            "Unable to coerce %s (\"%s\") to %s.\nValid enum constants - %s";
 
     /**
      * Creates a new bean dictionary.
      *
      * @param bean The bean object to wrap.
      */
-    public BeanAdapter(Object bean) {
+    public BeanAdapter(final Object bean) {
         this(bean, false);
     }
 
@@ -176,7 +180,7 @@ public class BeanAdapter implements Map<
      * @param ignoreReadOnlyProperties <tt>true</tt> if {@code final} or non-settable
      * fields should be excluded from the dictionary, <tt>false</tt> to include all fields.
      */
-    public BeanAdapter(Object bean, boolean ignoreReadOnlyProperties) {
+    public BeanAdapter(final Object bean, final boolean ignoreReadOnlyProperties) {
         Utils.checkNull(bean, "bean object");
 
         this.bean = bean;
@@ -200,7 +204,7 @@ public class BeanAdapter implements Map<
      * method exists.
      */
     @Override
-    public Object get(String key) {
+    public Object get(final String key) {
         Utils.checkNullOrEmpty(key, "key");
 
         Object value = null;
@@ -323,7 +327,7 @@ public class BeanAdapter implements Map<
      * exist or are read-only.
      */
     @Override
-    public void putAll(Map<String, Object> valueMap) {
+    public void putAll(final Map<String, Object> valueMap) {
         for (String key : valueMap) {
             put(key, valueMap.get(key));
         }
@@ -344,7 +348,7 @@ public class BeanAdapter implements Map<
      * @return <code>true</code> if any exceptions were caught,
      * <code>false</code> if not.
      */
-    public boolean putAll(Map<String, ?> valueMap, boolean ignoreErrors) {
+    public boolean putAll(final Map<String, ?> valueMap, final boolean ignoreErrors) {
         boolean anyErrors = false;
         for (String key : valueMap) {
             try {
@@ -363,7 +367,8 @@ public class BeanAdapter implements Map<
      * @throws UnsupportedOperationException This method is not supported.
      */
     @Override
-    public Object remove(String key) {
+    @UnsupportedOperation
+    public Object remove(final String key) {
         throw new UnsupportedOperationException();
     }
 
@@ -371,6 +376,7 @@ public class BeanAdapter implements Map<
      * @throws UnsupportedOperationException This method is not supported.
      */
     @Override
+    @UnsupportedOperation
     public synchronized void clear() {
         throw new UnsupportedOperationException();
     }
@@ -383,7 +389,7 @@ public class BeanAdapter implements Map<
      * @return <tt>true</tt> if the property exists; <tt>false</tt>, otherwise.
      */
     @Override
-    public boolean containsKey(String key) {
+    public boolean containsKey(final String key) {
         Utils.checkNullOrEmpty(key, "key");
 
         boolean containsKey = (getGetterMethod(key) != null);
@@ -399,6 +405,7 @@ public class BeanAdapter implements Map<
      * @throws UnsupportedOperationException This method is not supported.
      */
     @Override
+    @UnsupportedOperation
     public boolean isEmpty() {
         throw new UnsupportedOperationException();
     }
@@ -407,6 +414,7 @@ public class BeanAdapter implements Map<
      * @throws UnsupportedOperationException This method is not supported.
      */
     @Override
+    @UnsupportedOperation
     public int getCount() {
         throw new UnsupportedOperationException();
     }
@@ -420,7 +428,8 @@ public class BeanAdapter implements Map<
      * @throws UnsupportedOperationException This method is not supported.
      */
     @Override
-    public void setComparator(Comparator<String> comparator) {
+    @UnsupportedOperation
+    public void setComparator(final Comparator<String> comparator) {
         throw new UnsupportedOperationException();
     }
 
@@ -431,7 +440,7 @@ public class BeanAdapter implements Map<
      * @return <tt>true</tt> if the property is read-only; <tt>false</tt>,
      * otherwise.
      */
-    public boolean isReadOnly(String key) {
+    public boolean isReadOnly(final String key) {
         return isReadOnly(bean.getClass(), key);
     }
 
@@ -442,7 +451,7 @@ public class BeanAdapter implements Map<
      * @return The real class type of this property.
      * @see #getType(Class, String)
      */
-    public Class<?> getType(String key) {
+    public Class<?> getType(final String key) {
         return getType(bean.getClass(), key);
     }
 
@@ -453,7 +462,7 @@ public class BeanAdapter implements Map<
      * @return The generic type of this property.
      * @see #getGenericType(Class, String)
      */
-    public Type getGenericType(String key) {
+    public Type getGenericType(final String key) {
         return getGenericType(bean.getClass(), key);
     }
 
@@ -478,7 +487,7 @@ public class BeanAdapter implements Map<
      * @param key The property name.
      * @return The getter method, or <tt>null</tt> if the method does not exist.
      */
-    private Method getGetterMethod(String key) {
+    private Method getGetterMethod(final String key) {
         return getGetterMethod(bean.getClass(), key);
     }
 
@@ -486,9 +495,10 @@ public class BeanAdapter implements Map<
      * Returns the setter method for a property.
      *
      * @param key The property name.
+     * @param valueType The value type of the property in question.
      * @return The getter method, or <tt>null</tt> if the method does not exist.
      */
-    private Method getSetterMethod(String key, Class<?> valueType) {
+    private Method getSetterMethod(final String key, final Class<?> valueType) {
         return getSetterMethod(bean.getClass(), key, valueType);
     }
 
@@ -496,14 +506,12 @@ public class BeanAdapter implements Map<
      * Returns the public, non-static field for a property. Note that fields
      * will only be consulted for bean properties after bean methods.
      *
-     * @param fieldName The property name
+     * @param key The property name
      * @return The field, or <tt>null</tt> if the field does not exist, or is
      * non-public or static
      */
-    private Field getField(String fieldName) {
-        Utils.checkNull(fieldName, "fieldName");
-
-        return getField(bean.getClass(), fieldName);
+    private Field getField(final String key) {
+        return getField(bean.getClass(), key);
     }
 
     /**
@@ -516,7 +524,7 @@ public class BeanAdapter implements Map<
      * @return <tt>true</tt> if the property is read-only; <tt>false</tt>,
      * otherwise.
      */
-    public static boolean isReadOnly(Class<?> beanClass, String key) {
+    public static boolean isReadOnly(final Class<?> beanClass, final String key) {
         Utils.checkNull(beanClass, "beanClass");
         Utils.checkNullOrEmpty(key, "key");
 
@@ -544,7 +552,7 @@ public class BeanAdapter implements Map<
      * @return The type of the property, or <tt>null</tt> if no such bean
      * property exists.
      */
-    public static Class<?> getType(Class<?> beanClass, String key) {
+    public static Class<?> getType(final Class<?> beanClass, final String key) {
         Utils.checkNull(beanClass, "beanClass");
         Utils.checkNullOrEmpty(key, "key");
 
@@ -575,7 +583,7 @@ public class BeanAdapter implements Map<
      * {@link java.lang.reflect.ParameterizedType} will be returned. Otherwise,
      * an instance of {@link java.lang.Class} will be returned.
      */
-    public static Type getGenericType(Class<?> beanClass, String key) {
+    public static Type getGenericType(final Class<?> beanClass, final String key) {
         Utils.checkNull(beanClass, "beanClass");
         Utils.checkNullOrEmpty(key, "key");
 
@@ -605,7 +613,7 @@ public class BeanAdapter implements Map<
      * @return The field, or <tt>null</tt> if the field does not exist, or is
      * non-public or static.
      */
-    public static Field getField(Class<?> beanClass, String key) {
+    public static Field getField(final Class<?> beanClass, final String key) {
         Utils.checkNull(beanClass, "beanClass");
         Utils.checkNullOrEmpty(key, "key");
 
@@ -667,7 +675,8 @@ public class BeanAdapter implements Map<
      * @param valueType The type of the property.
      * @return The getter method, or <tt>null</tt> if the method does not exist.
      */
-    public static Method getSetterMethod(final Class<?> beanClass, final String key, final Class<?> valueType) {
+    public static Method getSetterMethod(final Class<?> beanClass, final String key,
+            final Class<?> valueType) {
         Utils.checkNull(beanClass, "beanClass");
         Utils.checkNullOrEmpty(key, "key");
 
@@ -738,7 +747,7 @@ public class BeanAdapter implements Map<
      * @throws IllegalArgumentException for all the possible other exceptions.
      */
     @SuppressWarnings("unchecked")
-    public static <T> T coerce(Object value, Class<? extends T> type, String key) {
+    public static <T> T coerce(final Object value, final Class<? extends T> type, final String key) {
         Utils.checkNull(type, "type");
 
         Object coercedValue;
@@ -757,8 +766,8 @@ public class BeanAdapter implements Map<
                     String valueString = value.toString().toUpperCase(Locale.ENGLISH);
                     Method valueOfMethod = type.getMethod(ENUM_VALUE_OF_METHOD_NAME, String.class);
                     coercedValue = valueOfMethod.invoke(null, valueString);
-                } catch (IllegalAccessException | InvocationTargetException |
-                       SecurityException | NoSuchMethodException e) {
+                } catch (IllegalAccessException | InvocationTargetException
+                        | SecurityException | NoSuchMethodException e) {
                     // Nothing to be gained by handling the getMethod() & invoke() exceptions separately
                     throw new IllegalArgumentException(String.format(
                         ENUM_COERCION_EXCEPTION_MESSAGE, value.getClass().getName(), value, type,

Modified: pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/adapter/MapAdapter.java Mon Jun  4 15:45:49 2018
@@ -32,6 +32,9 @@ import org.apache.pivot.util.Utils;
 /**
  * Implementation of the {@link Map} interface that is backed by an instance of
  * {@link java.util.Map}.
+ *
+ * @param <K> Type of the key objects.
+ * @param <V> Type of the value objects.
  */
 public class MapAdapter<K, V> implements Map<K, V>, Serializable {
     private static final long serialVersionUID = 4005649560306864969L;
@@ -39,7 +42,7 @@ public class MapAdapter<K, V> implements
     private java.util.Map<K, V> map = null;
     private transient MapListener.Listeners<K, V> mapListeners = new MapListener.Listeners<>();
 
-    public MapAdapter(java.util.Map<K, V> map) {
+    public MapAdapter(final java.util.Map<K, V> map) {
         Utils.checkNull(map, "map");
 
         this.map = map;
@@ -50,12 +53,12 @@ public class MapAdapter<K, V> implements
     }
 
     @Override
-    public V get(K key) {
+    public V get(final K key) {
         return map.get(key);
     }
 
     @Override
-    public V put(K key, V value) {
+    public V put(final K key, final V value) {
         boolean update = containsKey(key);
         V previousValue = map.put(key, value);
 
@@ -69,7 +72,7 @@ public class MapAdapter<K, V> implements
     }
 
     @Override
-    public V remove(K key) {
+    public V remove(final K key) {
         V value = null;
 
         if (containsKey(key)) {
@@ -89,7 +92,7 @@ public class MapAdapter<K, V> implements
     }
 
     @Override
-    public boolean containsKey(K key) {
+    public boolean containsKey(final K key) {
         return map.containsKey(key);
     }
 
@@ -113,7 +116,7 @@ public class MapAdapter<K, V> implements
     }
 
     @Override
-    public void setComparator(Comparator<K> comparator) {
+    public void setComparator(final Comparator<K> comparator) {
         Comparator<K> previousComparator = getComparator();
 
         // If the adapted map supports it, construct a new sorted map
@@ -126,8 +129,8 @@ public class MapAdapter<K, V> implements
                     mapLocal.putAll(this.map);
                     this.map = mapLocal;
                 }
-            } catch (SecurityException | NoSuchMethodException | IllegalArgumentException |
-                 InstantiationException | IllegalAccessException | InvocationTargetException exception) {
+            } catch (SecurityException | NoSuchMethodException | IllegalArgumentException
+                   | InstantiationException | IllegalAccessException | InvocationTargetException exception) {
                 throw new RuntimeException(exception);
             }
         }

Modified: pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/adapter/SetAdapter.java Mon Jun  4 15:45:49 2018
@@ -31,6 +31,8 @@ import org.apache.pivot.util.Utils;
 /**
  * Implementation of the {@link Set} interface that is backed by an instance of
  * {@link java.util.Set}.
+ *
+ * @param <E> Type of element in the set.
  */
 public class SetAdapter<E> implements Set<E>, Serializable {
     private static final long serialVersionUID = -816891924416727900L;
@@ -38,7 +40,7 @@ public class SetAdapter<E> implements Se
     private java.util.Set<E> set = null;
     private transient SetListener.Listeners<E> setListeners = new SetListener.Listeners<>();
 
-    public SetAdapter(java.util.Set<E> set) {
+    public SetAdapter(final java.util.Set<E> set) {
         Utils.checkNull(set, "set");
 
         this.set = set;
@@ -49,7 +51,7 @@ public class SetAdapter<E> implements Se
     }
 
     @Override
-    public boolean add(E element) {
+    public boolean add(final E element) {
         boolean added = false;
 
         if (!contains(element)) {
@@ -63,7 +65,7 @@ public class SetAdapter<E> implements Se
     }
 
     @Override
-    public boolean remove(E element) {
+    public boolean remove(final E element) {
         boolean removed = false;
 
         if (contains(element)) {
@@ -85,7 +87,7 @@ public class SetAdapter<E> implements Se
     }
 
     @Override
-    public boolean contains(E element) {
+    public boolean contains(final E element) {
         return set.contains(element);
     }
 
@@ -109,7 +111,7 @@ public class SetAdapter<E> implements Se
     }
 
     @Override
-    public void setComparator(Comparator<E> comparator) {
+    public void setComparator(final Comparator<E> comparator) {
         Comparator<E> previousComparator = getComparator();
 
         // If the adapted set supports it, construct a new sorted set
@@ -118,12 +120,12 @@ public class SetAdapter<E> implements Se
                 Constructor<?> constructor = this.set.getClass().getConstructor(Comparator.class);
                 if (constructor != null) {
                     @SuppressWarnings("unchecked")
-                    java.util.SortedSet<E> setLocal = (java.util.SortedSet<E>) constructor.newInstance(comparator);
+                    java.util.Set<E> setLocal = (java.util.Set<E>) constructor.newInstance(comparator);
                     setLocal.addAll(this.set);
                     this.set = setLocal;
                 }
-            } catch (SecurityException | NoSuchMethodException | IllegalArgumentException |
-                 InstantiationException | IllegalAccessException | InvocationTargetException exception) {
+            } catch (SecurityException | NoSuchMethodException | IllegalArgumentException
+                   | InstantiationException | IllegalAccessException | InvocationTargetException exception) {
                 throw new RuntimeException(exception);
             }
         }

Modified: pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java Mon Jun  4 15:45:49 2018
@@ -71,20 +71,21 @@ public class JSONSerializer implements S
     public static final String JSON_EXTENSION = "json";
     public static final String MIME_TYPE = "application/json";
     public static final int BUFFER_SIZE = 2048;
+    public static final int BYTE_ORDER_MARK = 0xFEFF;
 
     public JSONSerializer() {
         this(Charset.forName(DEFAULT_CHARSET_NAME), DEFAULT_TYPE);
     }
 
-    public JSONSerializer(Charset charset) {
+    public JSONSerializer(final Charset charset) {
         this(charset, DEFAULT_TYPE);
     }
 
-    public JSONSerializer(Type type) {
+    public JSONSerializer(final Type type) {
         this(Charset.forName(DEFAULT_CHARSET_NAME), type);
     }
 
-    public JSONSerializer(Charset charset, Type type) {
+    public JSONSerializer(final Charset charset, final Type type) {
         Utils.checkNull(charset, "charset");
         Utils.checkNull(type, "type");
 
@@ -127,7 +128,7 @@ public class JSONSerializer implements S
      * @param alwaysDelimitMapKeys <tt>true</tt> to bound map keys in double
      * quotes; <tt>false</tt> to only quote-delimit keys as necessary.
      */
-    public void setAlwaysDelimitMapKeys(boolean alwaysDelimitMapKeys) {
+    public void setAlwaysDelimitMapKeys(final boolean alwaysDelimitMapKeys) {
         this.alwaysDelimitMapKeys = alwaysDelimitMapKeys;
     }
 
@@ -145,7 +146,7 @@ public class JSONSerializer implements S
      *
      * @param verbose <tt>true</tt> to set verbose mode, <tt>false</tt> to disable.
      */
-    public void setVerbose(boolean verbose) {
+    public void setVerbose(final boolean verbose) {
         this.verbose = verbose;
     }
 
@@ -166,7 +167,7 @@ public class JSONSerializer implements S
      * The flag must be set to true in order to activate this feature, because there is a
      * definitely measured 25x slowdown when using it, even if no macros are defined.
      */
-    public void setAllowMacros(boolean macros) {
+    public void setAllowMacros(final boolean macros) {
         this.macros = macros;
     }
 
@@ -178,7 +179,7 @@ public class JSONSerializer implements S
      */
     @SuppressWarnings("resource")
     @Override
-    public Object readObject(InputStream inputStream) throws IOException, SerializationException {
+    public Object readObject(final InputStream inputStream) throws IOException, SerializationException {
         Utils.checkNull(inputStream, "inputStream");
 
         Reader reader = new BufferedReader(new InputStreamReader(inputStream, charset), BUFFER_SIZE);
@@ -208,7 +209,7 @@ public class JSONSerializer implements S
      * @throws IOException for any I/O related errors while reading.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public Object readObject(Reader reader) throws IOException, SerializationException {
+    public Object readObject(final Reader reader) throws IOException, SerializationException {
         Utils.checkNull(reader, "reader");
 
         LineNumberReader lineNumberReader = new LineNumberReader(reader);
@@ -220,7 +221,7 @@ public class JSONSerializer implements S
         c = realReader.read();
 
         // Ignore BOM (if present)
-        if (c == 0xFEFF) {
+        if (c == BYTE_ORDER_MARK) {
             c = realReader.read();
         }
 
@@ -238,8 +239,8 @@ public class JSONSerializer implements S
         return object;
     }
 
-    private Object readValue(Reader reader, Type typeArgument, String key) throws IOException,
-        SerializationException {
+    private Object readValue(final Reader reader, final Type typeArgument, final String key)
+        throws IOException, SerializationException {
         Object object = null;
 
         skipWhitespaceAndComments(reader);
@@ -261,14 +262,13 @@ public class JSONSerializer implements S
         } else if (c == '{') {
             object = readMapValue(reader, typeArgument);
         } else {
-            throw new SerializationException("Unexpected character in input stream: '" + (char)c + "'");
+            throw new SerializationException("Unexpected character in input stream: '" + (char) c + "'");
         }
 
         return object;
     }
 
-    private void skipWhitespaceAndComments(Reader reader) throws IOException,
-        SerializationException {
+    private void skipWhitespaceAndComments(final Reader reader) throws IOException, SerializationException {
         while (c != -1 && (Character.isWhitespace(c) || c == '/')) {
             boolean comment = (c == '/');
 
@@ -302,13 +302,13 @@ public class JSONSerializer implements S
                         c = reader.read();
                     }
                 } else {
-                    throw new SerializationException("Unexpected character in input stream: '" + (char)c + "'");
+                    throw new SerializationException("Unexpected character in input stream: '" + (char) c + "'");
                 }
             }
         }
     }
 
-    private Object readNullValue(Reader reader) throws IOException, SerializationException {
+    private Object readNullValue(final Reader reader) throws IOException, SerializationException {
         String nullString = "null";
 
         int n = nullString.length();
@@ -316,7 +316,7 @@ public class JSONSerializer implements S
 
         while (c != -1 && i < n) {
             if (nullString.charAt(i) != c) {
-                throw new SerializationException("Unexpected character in input stream: '" + (char)c + "'");
+                throw new SerializationException("Unexpected character in input stream: '" + (char) c + "'");
             }
 
             c = reader.read();
@@ -335,7 +335,7 @@ public class JSONSerializer implements S
         return null;
     }
 
-    private String readString(Reader reader) throws IOException, SerializationException {
+    private String readString(final Reader reader) throws IOException, SerializationException {
         StringBuilder stringBuilder = new StringBuilder();
 
         // Use the same delimiter to close the string
@@ -394,7 +394,7 @@ public class JSONSerializer implements S
         return stringBuilder.toString();
     }
 
-    private Object readStringValue(Reader reader, Type typeArgument, String key)
+    private Object readStringValue(final Reader reader, final Type typeArgument, final String key)
         throws IOException, SerializationException {
         if (!(typeArgument instanceof Class<?>)) {
             throw new SerializationException("Cannot convert string to " + typeArgument + ".");
@@ -410,8 +410,8 @@ public class JSONSerializer implements S
         return BeanAdapter.coerce(string, (Class<?>) typeArgument, key);
     }
 
-    private Object readNumberValue(Reader reader, Type typeArgument, String key) throws IOException,
-        SerializationException {
+    private Object readNumberValue(final Reader reader, final Type typeArgument, final String key)
+        throws IOException, SerializationException {
         if (!(typeArgument instanceof Class<?>)) {
             throw new SerializationException("Cannot convert number to " + typeArgument + ".");
         }
@@ -453,8 +453,8 @@ public class JSONSerializer implements S
         return BeanAdapter.coerce(number, (Class<?>) typeArgument, key);
     }
 
-    private Object readBooleanValue(Reader reader, Type typeArgument, String key) throws IOException,
-        SerializationException {
+    private Object readBooleanValue(final Reader reader, final Type typeArgument, final String key)
+        throws IOException, SerializationException {
         if (!(typeArgument instanceof Class<?>)) {
             throw new SerializationException("Cannot convert boolean to " + typeArgument + ".");
         }
@@ -465,7 +465,7 @@ public class JSONSerializer implements S
 
         while (c != -1 && i < n) {
             if (text.charAt(i) != c) {
-                throw new SerializationException("Unexpected character in input stream: '" + (char)c + "'");
+                throw new SerializationException("Unexpected character in input stream: '" + (char) c + "'");
             }
 
             c = reader.read();
@@ -488,8 +488,8 @@ public class JSONSerializer implements S
     }
 
     @SuppressWarnings("unchecked")
-    private Object readListValue(Reader reader, Type typeArgument, String key) throws IOException,
-        SerializationException {
+    private Object readListValue(final Reader reader, final Type typeArgument, final String key)
+        throws IOException, SerializationException {
         Sequence<Object> sequence = null;
         Type itemType = null;
 
@@ -556,9 +556,7 @@ public class JSONSerializer implements S
 
             try {
                 sequence = (Sequence<Object>) sequenceType.newInstance();
-            } catch (InstantiationException exception) {
-                throw new RuntimeException(exception);
-            } catch (IllegalAccessException exception) {
+            } catch (InstantiationException | IllegalAccessException exception) {
                 throw new RuntimeException(exception);
             }
         }
@@ -583,7 +581,7 @@ public class JSONSerializer implements S
                 throw new SerializationException("Unexpected end of input stream.");
             } else {
                 if (c != ']') {
-                    throw new SerializationException("Unexpected character in input stream: '" + (char)c + "'");
+                    throw new SerializationException("Unexpected character in input stream: '" + (char) c + "'");
                 }
             }
         }
@@ -600,8 +598,8 @@ public class JSONSerializer implements S
     }
 
     @SuppressWarnings("unchecked")
-    private Object readMapValue(Reader reader, Type typeArgument) throws IOException,
-        SerializationException {
+    private Object readMapValue(final Reader reader, final Type typeArgument)
+        throws IOException, SerializationException {
         Dictionary<String, Object> dictionary = null;
         Type valueType = null;
 
@@ -659,9 +657,7 @@ public class JSONSerializer implements S
 
                 try {
                     dictionary = new BeanAdapter(beanType.newInstance());
-                } catch (InstantiationException exception) {
-                    throw new RuntimeException(exception);
-                } catch (IllegalAccessException exception) {
+                } catch (InstantiationException | IllegalAccessException exception) {
                     throw new RuntimeException(exception);
                 }
             } else {
@@ -675,9 +671,7 @@ public class JSONSerializer implements S
 
                 try {
                     dictionary = (Dictionary<String, Object>) dictionaryType.newInstance();
-                } catch (InstantiationException exception) {
-                    throw new RuntimeException(exception);
-                } catch (IllegalAccessException exception) {
+                } catch (InstantiationException | IllegalAccessException exception) {
                     throw new RuntimeException(exception);
                 }
             }
@@ -735,7 +729,7 @@ public class JSONSerializer implements S
             skipWhitespaceAndComments(reader);
 
             if (c != ':') {
-                throw new SerializationException("Unexpected character in input stream: '" + (char)c + "'");
+                throw new SerializationException("Unexpected character in input stream: '" + (char) c + "'");
             }
 
             // Move to the first character after ':'
@@ -765,7 +759,7 @@ public class JSONSerializer implements S
                 throw new SerializationException("Unexpected end of input stream.");
             } else {
                 if (c != '}') {
-                    throw new SerializationException("Unexpected character in input stream: '" + (char)c + "'");
+                    throw new SerializationException("Unexpected character in input stream: '" + (char) c + "'");
                 }
             }
         }
@@ -793,8 +787,8 @@ public class JSONSerializer implements S
      */
     @SuppressWarnings("resource")
     @Override
-    public void writeObject(Object object, OutputStream outputStream) throws IOException,
-        SerializationException {
+    public void writeObject(final Object object, final OutputStream outputStream)
+        throws IOException, SerializationException {
         Utils.checkNull(outputStream, "outputStream");
 
         Writer writer = new BufferedWriter(new OutputStreamWriter(outputStream, charset),
@@ -824,8 +818,8 @@ public class JSONSerializer implements S
      * @throws SerializationException for any formatting errors in the data.
      */
     @SuppressWarnings("unchecked")
-    public void writeObject(Object object, Writer writer) throws IOException,
-        SerializationException {
+    public void writeObject(final Object object, final Writer writer)
+        throws IOException, SerializationException {
         Utils.checkNull(writer, "writer");
 
         if (object == null) {
@@ -838,49 +832,37 @@ public class JSONSerializer implements S
                 char ci = string.charAt(i);
 
                 switch (ci) {
-                    case '\t': {
+                    case '\t':
                         stringBuilder.append("\\t");
                         break;
-                    }
-
-                    case '\n': {
+                    case '\n':
                         stringBuilder.append("\\n");
                         break;
-                    }
-
-                    case '\r': {
+                    case '\r':
                         stringBuilder.append("\\r");
                         break;
-                    }
-
-                    case '\f': {
+                    case '\f':
                         stringBuilder.append("\\f");
                         break;
-                    }
-
-                    case '\b': {
+                    case '\b':
                         stringBuilder.append("\\b");
                         break;
-                    }
-
                     case '\\':
                     case '\"':
-                    case '\'': {
+                    case '\'':
                         stringBuilder.append("\\" + ci);
                         break;
-                    }
-
-                    default: {
+                    default:
                         // For Unicode character sets if it is a control character, then use \\uXXXX notation
                         // and for other character sets if the value is an ASCII control character.
-                        if ((charset.name().startsWith("UTF") && !Character.isISOControl(ci)) ||
-                            (ci > 0x1F && ci != 0x7F && ci <= 0xFF)) {
+                        if ((charset.name().startsWith("UTF") && !Character.isISOControl(ci))
+                         || (ci > 0x1F && ci != 0x7F && ci <= 0xFF)) {
                             stringBuilder.append(ci);
                         } else {
                             stringBuilder.append("\\u");
                             stringBuilder.append(String.format("%04x", (short) ci));
                         }
-                    }
+                        break;
                 }
 
             }
@@ -924,7 +906,7 @@ public class JSONSerializer implements S
             if (object instanceof Map<?, ?>) {
                 map = (Map<String, Object>) object;
             } else if (object instanceof java.util.Map<?, ?>) {
-                map = new MapAdapter<>((java.util.Map<String, Object>)object);
+                map = new MapAdapter<>((java.util.Map<String, Object>) object);
             } else {
                 map = new BeanAdapter(object, true);
             }
@@ -981,7 +963,7 @@ public class JSONSerializer implements S
     }
 
     @Override
-    public String getMIMEType(Object object) {
+    public String getMIMEType(final Object object) {
         return MIME_TYPE + "; charset=" + charset.name();
     }
 
@@ -992,7 +974,7 @@ public class JSONSerializer implements S
      * @return The parsed object.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Object parse(String json) throws SerializationException {
+    public static Object parse(final String json) throws SerializationException {
         JSONSerializer jsonSerializer = new JSONSerializer();
 
         Object object;
@@ -1012,7 +994,7 @@ public class JSONSerializer implements S
      * @return The parsed string.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static String parseString(String json) throws SerializationException {
+    public static String parseString(final String json) throws SerializationException {
         return (String) parse(json);
     }
 
@@ -1023,7 +1005,7 @@ public class JSONSerializer implements S
      * @return The parsed number.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Number parseNumber(String json) throws SerializationException {
+    public static Number parseNumber(final String json) throws SerializationException {
         return (Number) parse(json);
     }
 
@@ -1034,7 +1016,7 @@ public class JSONSerializer implements S
      * @return The parsed short.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Short parseShort(String json) throws SerializationException {
+    public static Short parseShort(final String json) throws SerializationException {
         return (Short) parse(json);
     }
 
@@ -1045,7 +1027,7 @@ public class JSONSerializer implements S
      * @return The parsed integer.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Integer parseInteger(String json) throws SerializationException {
+    public static Integer parseInteger(final String json) throws SerializationException {
         return (Integer) parse(json);
     }
 
@@ -1056,7 +1038,7 @@ public class JSONSerializer implements S
      * @return The parsed number.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Long parseLong(String json) throws SerializationException {
+    public static Long parseLong(final String json) throws SerializationException {
         return (Long) parse(json);
     }
 
@@ -1067,7 +1049,7 @@ public class JSONSerializer implements S
      * @return The parsed float.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Float parseFloat(String json) throws SerializationException {
+    public static Float parseFloat(final String json) throws SerializationException {
         return (Float) parse(json);
     }
 
@@ -1078,7 +1060,7 @@ public class JSONSerializer implements S
      * @return The parsed double.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Double parseDouble(String json) throws SerializationException {
+    public static Double parseDouble(final String json) throws SerializationException {
         return (Double) parse(json);
     }
 
@@ -1089,7 +1071,7 @@ public class JSONSerializer implements S
      * @return The parsed boolean.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static Boolean parseBoolean(String json) throws SerializationException {
+    public static Boolean parseBoolean(final String json) throws SerializationException {
         return (Boolean) parse(json);
     }
 
@@ -1100,7 +1082,7 @@ public class JSONSerializer implements S
      * @return The parsed list.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static List<?> parseList(String json) throws SerializationException {
+    public static List<?> parseList(final String json) throws SerializationException {
         return (List<?>) parse(json);
     }
 
@@ -1112,7 +1094,7 @@ public class JSONSerializer implements S
      * @throws SerializationException for any formatting errors in the data.
      */
     @SuppressWarnings("unchecked")
-    public static Map<String, ?> parseMap(String json) throws SerializationException {
+    public static Map<String, ?> parseMap(final String json) throws SerializationException {
         return (Map<String, ?>) parse(json);
     }
 
@@ -1125,7 +1107,7 @@ public class JSONSerializer implements S
      * @throws SerializationException for any formatting errors in the data.
      * @see #toString(Object, boolean)
      */
-    public static String toString(Object value) throws SerializationException {
+    public static String toString(final Object value) throws SerializationException {
         return toString(value, false);
     }
 
@@ -1138,7 +1120,7 @@ public class JSONSerializer implements S
      * @return The resulting JSON string.
      * @throws SerializationException for any formatting errors in the data.
      */
-    public static String toString(Object value, boolean alwaysDelimitMapKeys)
+    public static String toString(final Object value, final boolean alwaysDelimitMapKeys)
         throws SerializationException {
         JSONSerializer jsonSerializer = new JSONSerializer();
         jsonSerializer.setAlwaysDelimitMapKeys(alwaysDelimitMapKeys);

Modified: pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/CalendarDate.java Mon Jun  4 15:45:49 2018
@@ -49,32 +49,32 @@ public final class CalendarDate implemen
         public final CalendarDate start;
         public final CalendarDate end;
 
-        public Range(CalendarDate calendarDate) {
+        public Range(final CalendarDate calendarDate) {
             this(calendarDate, calendarDate);
         }
 
-        public Range(CalendarDate start, CalendarDate end) {
+        public Range(final CalendarDate start, final CalendarDate end) {
             this.start = start;
             this.end = end;
         }
 
-        public Range(String date) {
+        public Range(final String date) {
             this.start = this.end = CalendarDate.decode(date);
         }
 
-        public Range(String start, String end) {
+        public Range(final String start, final String end) {
             this.start = CalendarDate.decode(start);
             this.end = CalendarDate.decode(end);
         }
 
-        public Range(Range range) {
+        public Range(final Range range) {
             Utils.checkNull(range, "range");
 
             this.start = range.start;
             this.end = range.end;
         }
 
-        public Range(Dictionary<String, ?> range) {
+        public Range(final Dictionary<String, ?> range) {
             Utils.checkNull(range, "range");
 
             Object startRange = range.get(START_KEY);
@@ -101,7 +101,7 @@ public final class CalendarDate implemen
             }
         }
 
-        public Range(Sequence<?> range) {
+        public Range(final Sequence<?> range) {
             Utils.checkNull(range, "range");
 
             Object startRange = range.get(0);
@@ -124,22 +124,24 @@ public final class CalendarDate implemen
             return Math.abs(this.start.subtract(this.end)) + 1;
         }
 
-        public boolean contains(Range range) {
+        public boolean contains(final Range range) {
             Utils.checkNull(range, "range");
 
             Range normalizedRange = range.normalize();
 
             boolean contains;
             if (this.start.compareTo(this.end) < 0) {
-                contains = (this.start.compareTo(normalizedRange.start) <= 0 && this.end.compareTo(normalizedRange.end) >= 0);
+                contains = (this.start.compareTo(normalizedRange.start) <= 0
+                         && this.end.compareTo(normalizedRange.end) >= 0);
             } else {
-                contains = (this.end.compareTo(normalizedRange.start) <= 0 && this.start.compareTo(normalizedRange.end) >= 0);
+                contains = (this.end.compareTo(normalizedRange.start) <= 0
+                         && this.start.compareTo(normalizedRange.end) >= 0);
             }
 
             return contains;
         }
 
-        public boolean contains(CalendarDate calendarDate) {
+        public boolean contains(final CalendarDate calendarDate) {
             Utils.checkNull(calendarDate, "calendarDate");
 
             boolean contains;
@@ -152,16 +154,18 @@ public final class CalendarDate implemen
             return contains;
         }
 
-        public boolean intersects(Range range) {
+        public boolean intersects(final Range range) {
             Utils.checkNull(range, "range");
 
             Range normalizedRange = range.normalize();
 
             boolean intersects;
             if (this.start.compareTo(this.end) < 0) {
-                intersects = (this.start.compareTo(normalizedRange.end) <= 0 && this.end.compareTo(normalizedRange.start) >= 0);
+                intersects = (this.start.compareTo(normalizedRange.end) <= 0
+                           && this.end.compareTo(normalizedRange.start) >= 0);
             } else {
-                intersects = (this.end.compareTo(normalizedRange.end) <= 0 && this.start.compareTo(normalizedRange.start) >= 0);
+                intersects = (this.end.compareTo(normalizedRange.end) <= 0
+                           && this.start.compareTo(normalizedRange.start) >= 0);
             }
 
             return intersects;
@@ -174,11 +178,10 @@ public final class CalendarDate implemen
         }
 
         @Override
-        public boolean equals(Object o) {
+        public boolean equals(final Object o) {
             if (o != null && o instanceof Range) {
-                Range r = (Range)o;
-                return r.start.equals(this.start) &&
-                    r.end.equals(this.end);
+                Range r = (Range) o;
+                return r.start.equals(this.start) && r.end.equals(this.end);
             }
             return false;
         }
@@ -189,8 +192,8 @@ public final class CalendarDate implemen
             return start.hashCode() * end.hashCode();
         }
 
-        public static Range decode(String value) {
-            Utils.checkNull(value, "value");
+        public static Range decode(final String value) {
+            Utils.checkNullOrEmpty(value, "value");
 
             Range range;
             if (value.startsWith("{")) {
@@ -235,7 +238,7 @@ public final class CalendarDate implemen
      */
     public final int day;
 
-    private static final int[] MONTH_LENGTHS = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+    private static final int[] MONTH_LENGTHS = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
 
     private static final Pattern PATTERN = Pattern.compile("^(\\d{4})-(\\d{2})-(\\d{2})$");
 
@@ -261,7 +264,7 @@ public final class CalendarDate implemen
      *
      * @param calendar The calendar containing the year, month, and day fields.
      */
-    public CalendarDate(GregorianCalendar calendar) {
+    public CalendarDate(final GregorianCalendar calendar) {
         this(calendar.get(Calendar.YEAR),
              calendar.get(Calendar.MONTH),
              calendar.get(Calendar.DAY_OF_MONTH) - 1);
@@ -274,7 +277,7 @@ public final class CalendarDate implemen
      *
      * @param localDate The date value containing year, month and day fields.
      */
-    public CalendarDate(LocalDate localDate) {
+    public CalendarDate(final LocalDate localDate) {
         this(localDate.getYear(),
              localDate.getMonthValue() - 1,
              localDate.getDayOfMonth() - 1);
@@ -290,7 +293,7 @@ public final class CalendarDate implemen
      * @see #MIN_CALENDAR_YEAR
      * @see #MAX_CALENDAR_YEAR
      */
-    public CalendarDate(int year, int month, int day) {
+    public CalendarDate(final int year, final int month, final int day) {
         if (year < MIN_CALENDAR_YEAR || year > MAX_CALENDAR_YEAR) {
             throw new IllegalArgumentException("Invalid year: " + year);
         }
@@ -301,8 +304,7 @@ public final class CalendarDate implemen
 
         int daysInMonth = MONTH_LENGTHS[month];
 
-        boolean isLeapYear = ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0));
-        if (isLeapYear && month == 1) {
+        if (isLeapYear(year) && month == 1) {
             daysInMonth++;
         }
 
@@ -327,7 +329,7 @@ public final class CalendarDate implemen
      * this calendar date.
      * @return The resulting calendar date.
      */
-    public CalendarDate add(int days) {
+    public CalendarDate add(final int days) {
         GregorianCalendar calendar = toCalendar();
         calendar.add(Calendar.DAY_OF_YEAR, days);
         return new CalendarDate(calendar);
@@ -345,7 +347,7 @@ public final class CalendarDate implemen
      * this calendar date.
      * @return The resulting calendar date.
      */
-    public CalendarDate addMonths(int months) {
+    public CalendarDate addMonths(final int months) {
         GregorianCalendar calendar = toCalendar();
         calendar.add(Calendar.MONTH, months);
         return new CalendarDate(calendar);
@@ -363,7 +365,7 @@ public final class CalendarDate implemen
      * this calendar date.
      * @return The resulting calendar date.
      */
-    public CalendarDate addYears(int years) {
+    public CalendarDate addYears(final int years) {
         GregorianCalendar calendar = toCalendar();
         calendar.add(Calendar.YEAR, years);
         return new CalendarDate(calendar);
@@ -384,7 +386,7 @@ public final class CalendarDate implemen
      * @return The number of days in between this calendar date and
      * <tt>calendarDate</tt>.
      */
-    public int subtract(CalendarDate calendarDate) {
+    public int subtract(final CalendarDate calendarDate) {
         GregorianCalendar c1 = toCalendar();
         GregorianCalendar c2 = calendarDate.toCalendar();
 
@@ -415,7 +417,7 @@ public final class CalendarDate implemen
      * @param time The time of day.
      * @return This calendar date as a <tt>GregorianCalendar</tt>.
      */
-    public GregorianCalendar toCalendar(Time time) {
+    public GregorianCalendar toCalendar(final Time time) {
         GregorianCalendar calendar = new GregorianCalendar(this.year, this.month, this.day + 1,
             time.hour, time.minute, time.second);
         calendar.set(Calendar.MILLISECOND, time.millisecond);
@@ -437,7 +439,7 @@ public final class CalendarDate implemen
      *
      * @param time The wall clock time to combine with this calendar date.
      */
-    public LocalDateTime toLocalDateTime(Time time) {
+    public LocalDateTime toLocalDateTime(final Time time) {
         LocalTime localTime = LocalTime.of(time.hour, time.minute, time.second, time.millisecond * 1_000_000);
         LocalDate localDate = toLocalDate();
         return localDate.atTime(localTime);
@@ -452,7 +454,7 @@ public final class CalendarDate implemen
      * respectively.
      */
     @Override
-    public int compareTo(CalendarDate calendarDate) {
+    public int compareTo(final CalendarDate calendarDate) {
         int result = this.year - calendarDate.year;
 
         if (result == 0) {
@@ -474,7 +476,7 @@ public final class CalendarDate implemen
      * @param o Reference to the object against which to compare.
      */
     @Override
-    public boolean equals(Object o) {
+    public boolean equals(final Object o) {
         return (o instanceof CalendarDate && ((CalendarDate) o).year == this.year
             && ((CalendarDate) o).month == this.month && ((CalendarDate) o).day == this.day);
     }
@@ -517,6 +519,15 @@ public final class CalendarDate implemen
     }
 
     /**
+     * @return Is the given year a leap year according to the standard definition?
+     *
+     * @param year The year to check.
+     */
+    public static boolean isLeapYear(final int year) {
+        return ((year & 3) == 0 && (year % 100 != 0 || year % 400 == 0));
+    }
+
+    /**
      * Creates a new date representing the specified date string. The date
      * string must be in the <tt>ISO 8601</tt> "calendar date" format, which is
      * <tt>[YYYY]-[MM]-[DD]</tt>.
@@ -525,7 +536,7 @@ public final class CalendarDate implemen
      * 2008-07-23).
      * @return The {@code CalendarDate} corresponding to the input string.
      */
-    public static CalendarDate decode(String value) {
+    public static CalendarDate decode(final String value) {
         Utils.checkNullOrEmpty(value, "calendarDate");
 
         Matcher matcher = PATTERN.matcher(value);

Modified: pivot/trunk/core/src/org/apache/pivot/util/Vote.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/Vote.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/Vote.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/Vote.java Mon Jun  4 15:45:49 2018
@@ -71,9 +71,8 @@ public enum Vote {
                 tally = (this == DENY) ? this : vote;
                 break;
 
-            default: {
+            default:
                 throw new IllegalArgumentException("Unknown Vote value to tally.");
-            }
         }
 
         return tally;

Modified: pivot/trunk/core/src/org/apache/pivot/util/VoteResult.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/util/VoteResult.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/util/VoteResult.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/util/VoteResult.java Mon Jun  4 15:45:49 2018
@@ -18,7 +18,7 @@ package org.apache.pivot.util;
 
 /**
  * An object holding the result of a {@link Vote#tally} that can be
- * used with a <tt>forEach</tt> or lambda expressionm, where the value
+ * used with a <tt>forEach</tt> or lambda expression, where the value
  * used during the iteration must be final or effectively final.
  */
 public class VoteResult {

Modified: pivot/trunk/pivot_checks.xml
URL: http://svn.apache.org/viewvc/pivot/trunk/pivot_checks.xml?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/pivot_checks.xml (original)
+++ pivot/trunk/pivot_checks.xml Mon Jun  4 15:45:49 2018
@@ -112,7 +112,7 @@
         <!-- Checks for Size Violations.                    -->
         <!-- See http://checkstyle.sf.net/config_sizes.html -->
         <module name="LineLength">
-            <property name="max" value="110"/>
+            <property name="max" value="120"/>
         </module>
         <module name="MethodLength">
             <property name="max" value="200"/>

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java?rev=1832861&r1=1832860&r2=1832861&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Bounds.java Mon Jun  4 15:45:49 2018
@@ -16,6 +16,7 @@
  */
 package org.apache.pivot.wtk;
 
+import java.awt.Rectangle;
 import java.io.Serializable;
 
 import org.apache.pivot.collections.Dictionary;
@@ -50,7 +51,7 @@ public final class Bounds implements Ser
      * @param width  The width of the bounded area.
      * @param height The height of the area.
      */
-    public Bounds(int x, int y, int width, int height) {
+    public Bounds(final int x, final int y, final int width, final int height) {
         this.x = x;
         this.y = y;
         this.width = width;
@@ -63,7 +64,7 @@ public final class Bounds implements Ser
      * @param size   The size of the bounded area (must not be {@code null}).
      * @throws IllegalArgumentException if either argument is {@code null}.
      */
-    public Bounds(Point origin, Dimensions size) {
+    public Bounds(final Point origin, final Dimensions size) {
         Utils.checkNull(origin, "origin");
         Utils.checkNull(size, "size");
 
@@ -78,7 +79,7 @@ public final class Bounds implements Ser
      * @param size The size of the bounded area (must not be {@code null}).
      * @throws IllegalArgumentException if the size is {@code null}.
      */
-    public Bounds(Dimensions size) {
+    public Bounds(final Dimensions size) {
         Utils.checkNull(size, "size");
 
         x = 0;
@@ -92,7 +93,7 @@ public final class Bounds implements Ser
      * @param bounds The existing bounds to copy (cannot be {@code null}).
      * @throws IllegalArgumentException if the argument is {@code null}.
      */
-    public Bounds(Bounds bounds) {
+    public Bounds(final Bounds bounds) {
         Utils.checkNull(bounds, "bounds");
 
         x = bounds.x;
@@ -111,7 +112,7 @@ public final class Bounds implements Ser
      * {@link #WIDTH_KEY} and {@link #HEIGHT_KEY}.
      * @throws IllegalArgumentException if the bounds argument is {@code null}.
      */
-    public Bounds(Dictionary<String, ?> bounds) {
+    public Bounds(final Dictionary<String, ?> bounds) {
         Utils.checkNull(bounds, "bounds");
 
         x = bounds.getInt(X_KEY);
@@ -120,22 +121,30 @@ public final class Bounds implements Ser
         height = bounds.getInt(HEIGHT_KEY);
     }
 
-    public Bounds(Sequence<?> bounds) {
+    /**
+     * Construct a new bounds object given a sequence of the
+     * four needed values.
+     *
+     * @param bounds The sequence containing the bounds values,
+     * in the order of <tt>[ x, y, width, height ]</tt>
+     * @throws IllegalArgumentException if the bounds argument is {@code null}.
+     */
+    public Bounds(final Sequence<?> bounds) {
         Utils.checkNull(bounds, "bounds");
 
-        x = ((Number)bounds.get(0)).intValue();
-        y = ((Number)bounds.get(1)).intValue();
-        width = ((Number)bounds.get(2)).intValue();
-        height = ((Number)bounds.get(3)).intValue();
+        x = ((Number) bounds.get(0)).intValue();
+        y = ((Number) bounds.get(1)).intValue();
+        width = ((Number) bounds.get(2)).intValue();
+        height = ((Number) bounds.get(3)).intValue();
     }
 
     /**
-     * Convert a {@link java.awt.Rectangle} to one of our bounds objects.
+     * Convert a {@link Rectangle} to one of our bounds objects.
      * @param rectangle The existing rectangle to convert (cannot
      * be {@code null}).
      * @throws IllegalArgumentException if the rectangle is {@code null}.
      */
-    public Bounds(java.awt.Rectangle rectangle) {
+    public Bounds(final Rectangle rectangle) {
         Utils.checkNull(rectangle, "rectangle");
 
         x = rectangle.x;
@@ -173,7 +182,7 @@ public final class Bounds implements Ser
      * @return A new bounds that is the union of this one with the bounds specified by
      * the given arguments.
      */
-    public Bounds union(int xValue, int yValue, int widthValue, int heightValue) {
+    public Bounds union(final int xValue, final int yValue, final int widthValue, final int heightValue) {
         int x1 = Math.min(this.x, xValue);
         int y1 = Math.min(this.y, yValue);
         int x2 = Math.max(this.x + this.width, xValue + widthValue);
@@ -189,7 +198,7 @@ public final class Bounds implements Ser
      * @see #union(int, int, int, int)
      * @throws IllegalArgumentException if the given bounds is {@code null}.
      */
-    public Bounds union(Bounds bounds) {
+    public Bounds union(final Bounds bounds) {
         Utils.checkNull(bounds, "bounds");
 
         return union(bounds.x, bounds.y, bounds.width, bounds.height);
@@ -207,7 +216,7 @@ public final class Bounds implements Ser
      * @param heightValue The height of the other area.
      * @return The new bounds that is the intersection of this one and the given area.
      */
-    public Bounds intersect(int xValue, int yValue, int widthValue, int heightValue) {
+    public Bounds intersect(final int xValue, final int yValue, final int widthValue, final int heightValue) {
         int x1 = Math.max(this.x, xValue);
         int y1 = Math.max(this.y, yValue);
         int x2 = Math.min(this.x + this.width, xValue + widthValue);
@@ -222,7 +231,7 @@ public final class Bounds implements Ser
      * @throws IllegalArgumentException if the given bounds is {@code null}.
      * @see #intersect(int, int, int, int)
      */
-    public Bounds intersect(Bounds bounds) {
+    public Bounds intersect(final Bounds bounds) {
         Utils.checkNull(bounds, "bounds");
 
         return intersect(bounds.x, bounds.y, bounds.width, bounds.height);
@@ -235,7 +244,7 @@ public final class Bounds implements Ser
      * @throws IllegalArgumentException if the rectangle is {@code null}.
      * @see #intersect(int, int, int, int)
      */
-    public Bounds intersect(java.awt.Rectangle rect) {
+    public Bounds intersect(final Rectangle rect) {
         Utils.checkNull(rect, "rect");
 
         return intersect(rect.x, rect.y, rect.width, rect.height);
@@ -250,7 +259,7 @@ public final class Bounds implements Ser
      * @param dy The amount of translation in the Y-direction.
      * @return A new bounds offset by these amounts.
      */
-    public Bounds translate(int dx, int dy) {
+    public Bounds translate(final int dx, final int dy) {
         return new Bounds(x + dx, y + dy, width, height);
     }
 
@@ -262,7 +271,7 @@ public final class Bounds implements Ser
      * @param dh The amount of expansion(contraction) in the height.
      * @return A new bounds expanded by this amount.
      */
-    public Bounds expand(int dw, int dh) {
+    public Bounds expand(final int dw, final int dh) {
         return new Bounds(x, y, width + dw, height + dh);
     }
 
@@ -273,7 +282,7 @@ public final class Bounds implements Ser
      * @throws IllegalArgumentException if the offset value is {@code null}.
      * @see #translate(int, int)
      */
-    public Bounds translate(Point offset) {
+    public Bounds translate(final Point offset) {
         Utils.checkNull(offset, "offset");
 
         return translate(offset.x, offset.y);
@@ -285,7 +294,7 @@ public final class Bounds implements Ser
      * @throws IllegalArgumentException if the point argument is {@code null}.
      * @see #contains(int, int)
      */
-    public boolean contains(Point point) {
+    public boolean contains(final Point point) {
         Utils.checkNull(point, "point");
 
         return contains(point.x, point.y);
@@ -297,11 +306,11 @@ public final class Bounds implements Ser
      * @param yValue The Y-position of the other point to test.
      * @return Whether this bounds contains the given point.
      */
-    public boolean contains(int xValue, int yValue) {
-        return (xValue >= this.x &&
-                yValue >= this.y &&
-                xValue < this.x + width &&
-                yValue < this.y + height);
+    public boolean contains(final int xValue, final int yValue) {
+        return (xValue >= this.x
+             && yValue >= this.y
+             && xValue < this.x + width
+             && yValue < this.y + height);
     }
 
     /**
@@ -311,7 +320,7 @@ public final class Bounds implements Ser
      * @throws IllegalArgumentException if the given bounds is {@code null}.
      * @see #contains(int, int, int, int)
      */
-    public boolean contains(Bounds bounds) {
+    public boolean contains(final Bounds bounds) {
         Utils.checkNull(bounds, "bounds");
 
         return contains(bounds.x, bounds.y, bounds.width, bounds.height);
@@ -325,12 +334,12 @@ public final class Bounds implements Ser
      * @param widthValue  The width of the other area.
      * @param heightValue The height of the area to test.
      */
-    public boolean contains(int xValue, int yValue, int widthValue, int heightValue) {
-        return (!isEmpty() &&
-                xValue >= this.x &&
-                yValue >= this.y &&
-                xValue + widthValue <= this.x + this.width &&
-                yValue + heightValue <= this.y + this.height);
+    public boolean contains(final int xValue, final int yValue, final int widthValue, final int heightValue) {
+        return (!isEmpty()
+             && xValue >= this.x
+             && yValue >= this.y
+             && xValue + widthValue <= this.x + this.width
+             && yValue + heightValue <= this.y + this.height);
     }
 
     /**
@@ -339,7 +348,7 @@ public final class Bounds implements Ser
      * @throws IllegalArgumentException if the given bounds is {@code null}.
      * @see #intersects(int, int, int, int)
      */
-    public boolean intersects(Bounds bounds) {
+    public boolean intersects(final Bounds bounds) {
         Utils.checkNull(bounds, "bounds");
 
         return intersects(bounds.x, bounds.y, bounds.width, bounds.height);
@@ -352,12 +361,12 @@ public final class Bounds implements Ser
      * @param widthValue  The width of the other bounded area.
      * @param heightValue The height of the other area.
      */
-    public boolean intersects(int xValue, int yValue, int widthValue, int heightValue) {
-        return (!isEmpty() &&
-                xValue + widthValue > this.x &&
-                yValue + heightValue > this.y &&
-                xValue < this.x + this.width &&
-                yValue < this.y + this.height);
+    public boolean intersects(final int xValue, final int yValue, final int widthValue, final int heightValue) {
+        return (!isEmpty()
+             && xValue + widthValue > this.x
+             && yValue + heightValue > this.y
+             && xValue < this.x + this.width
+             && yValue < this.y + this.height);
     }
 
     /**
@@ -370,13 +379,13 @@ public final class Bounds implements Ser
     }
 
     @Override
-    public boolean equals(Object object) {
+    public boolean equals(final Object object) {
         boolean equals = false;
 
         if (object instanceof Bounds) {
             Bounds bounds = (Bounds) object;
-            equals = (x == bounds.x && y == bounds.y &&
-                      width == bounds.width && height == bounds.height);
+            equals = (x == bounds.x && y == bounds.y
+                   && width == bounds.width && height == bounds.height);
         }
 
         return equals;
@@ -396,8 +405,8 @@ public final class Bounds implements Ser
     /**
      * @return This bounded area as a {@link java.awt.Rectangle}.
      */
-    public java.awt.Rectangle toRectangle() {
-        return new java.awt.Rectangle(x, y, width, height);
+    public Rectangle toRectangle() {
+        return new Rectangle(x, y, width, height);
     }
 
     /**
@@ -427,7 +436,7 @@ public final class Bounds implements Ser
      * @see #Bounds(Dictionary)
      * @see #Bounds(int, int, int, int)
      */
-    public static Bounds decode(String boundsValue) {
+    public static Bounds decode(final String boundsValue) {
         Utils.checkNullOrEmpty(boundsValue, "boundsValue");
 
         Bounds bounds;