You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Razan Abbass (JIRA)" <de...@velocity.apache.org> on 2010/10/10 15:55:30 UTC

[jira] Commented: (VELOCITY-701) migrating from 1.4 to 1.6.1 iteration over a List no longer works

    [ https://issues.apache.org/jira/browse/VELOCITY-701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12919603#action_12919603 ] 

Razan Abbass commented on VELOCITY-701:
---------------------------------------

[flights|http://getflightsto.com]
[baby names|http://childcareforums.com]


> migrating from 1.4 to 1.6.1 iteration over a List no longer works
> -----------------------------------------------------------------
>
>                 Key: VELOCITY-701
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-701
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 1.6.1
>         Environment: Linux, Sun Java 1.5
>            Reporter: chad davis
>             Fix For: 1.6.2, 1.7, 2.0
>
>
> I have a template that references a List returned by a method on an Enum.  The method is defined as an abstract member of the enum.  This used to work on 1.4, but doesn't work on 1.6.1  I'm able to get it to work on 1.6.1 by changing the abstract method to a regular method of the Enum, which is then overridden by each instance of the enum.  Here's the code that doesn't work.  
> Again, it seems to be the abstract modifier, becuase if I change that method to something like
> public List getMyList() { return new ArrayList(); }
> And then just override it in my enum instances, everything works fine.  
> public enum Thing {
>            NUMBER_ONE(  ){
>                        public List<String> getInnerThings() {
>                                //initialize innerThings if this is first time
>                                if ( this.innerThings == null ) {
>                                        innerThings = new ArrayList<String>();
>                                        innerThings.add( "blah blah" );
>                                        innerThings.add("blah blah"  );
>                                }
>                                return innerThings;
>                        }
>                },
>                 NUMBER_TWO(  ){
>                        public List<String> getinnerThings() {
>                                //initialize innerThings if this is first time
>                                if ( this.innerThings == null ) {
>                                        innerThings = new ArrayList<String>();
>                                        innerThings.add( "blah blah" );
>                                        innerThings.add("blah blah"  );
>                                }
>                                return innerThings;
>                        }
>                },
>                 NUMBER_THREE(  ){
>                        public List<String> getinnerThings() {
>                                if ( this.innerThings == null ) {
>                                        innerThings = new ArrayList<String>();
>                                        innerThings.add( "blah blah" );
>                                        innerThings.add("blah blah"  );
>                                }
>                                return innerThings;
>                        }
>                };
>        List<String> innerThings;
>        //This was an abstract method, but Velocity 1.6 quite working with it.
>        public abstract List<String> getinnerThings();
> }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@velocity.apache.org
For additional commands, e-mail: dev-help@velocity.apache.org