Some code generated to transform objects has no effect
------------------------------------------------------

         Key: SPRING-128
         URL: http://jira.andromda.org/browse/SPRING-128
     Project: Spring Cartridge
        Type: Bug
    Versions: 3.0RC1    
 Environment: All
    Reporter: Naresh Bhatia
 Assigned to: Chad Brandon 
    Priority: Minor


I am refering to the following code in SpringHibernateDaoBase.vsl:

    /**
     * @see 
com.sapient.highenergy.domain.TradeDao#toTradeSummaryVOCollection(java.util.Collection)
     */
    public final void toTradeSummaryVOCollection(java.util.Collection entities)
    {
        if (entities == null)
        {
            entities = java.util.Collections.EMPTY_LIST;
        }
        else
        {
            org.apache.commons.collections.CollectionUtils.transform(entities, 
TRADESUMMARYVO_TRANSFORMER);
        }
    }

The line "entities = java.util.Collections.EMPTY_LIST;" is completley useless 
because there is no way a new empty list can be returned to the caller. It may 
also be confusing and misleading for the reader who is trying to understand 
this code. Here is an example of what is generated:

    /**
     * @see 
com.sapient.highenergy.domain.TradeDao#toTradeSummaryVOCollection(java.util.Collection)
     */
    public final void toTradeSummaryVOCollection(java.util.Collection entities)
    {
        if (entities == null)
        {
            entities = java.util.Collections.EMPTY_LIST;
        }
        else
        {
            org.apache.commons.collections.CollectionUtils.transform(entities, 
TRADESUMMARYVO_TRANSFORMER);
        }
    }

Instead, I would like to see the following simpler version generated:

    /**
     * @see 
com.sapient.highenergy.domain.TradeDao#toTradeSummaryVOCollection(java.util.Collection)
     */
    public final void toTradeSummaryVOCollection(java.util.Collection entities)
    {
        if (entities != null)
        {
            org.apache.commons.collections.CollectionUtils.transform(entities, 
TRADESUMMARYVO_TRANSFORMER);
        }
    }





-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information

Reply via email to