jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Brosius <dbros...@apache.org>
Subject Curious method definition
Date Wed, 12 Oct 2011 05:34:36 GMT
The following method in class /

    /org.apache.jackrabbit.spi.commons.QNodeTypeDefinitionImpl /

would appear to return a set of serializable property definitions.

However, it would appear that it just returns a set-version of the 
passed in parameter, irrespective of whether the property defs are 
serializable or not.

A naive view would say the else block shouldn't be there.

If all property defs should be returned, there are much simpler ways to 
write this code.

      * Returns a set of serializable property definitions for
      * <code>propDefs</code>.
      * @param propDefs the SPI property definitions.
      * @return a set of serializable property definitions.
     private static Set<QPropertyDefinition> getSerializablePropertyDefs(
             QPropertyDefinition[] propDefs) {
         Set<QPropertyDefinition> defs = new HashSet<QPropertyDefinition>();
         for (QPropertyDefinition pd : propDefs) {
             if (pd instanceof Serializable) {
             } else {
*                defs.add(pd);*
         return defs;

View raw message