Velocity
  1. Velocity
  2. VELOCITY-219

Velocity list operator should return a Java List reference rather than ArrayList reference

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Invalid
    • Affects Version/s: 1.4
    • Fix Version/s: 1.5
    • Component/s: Engine
    • Labels:
      None
    • Environment:
      Operating System: All
      Platform: All

      Description

      In the 1.x releases of Velocity, the list operator [] returns an ArrayList
      reference instead of a List reference. In the future (2.x), a cleaner API would
      be to return a List reference.

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        1104d 9h 33m 1 Henning Schmiedehausen 06/Nov/06 21:20
        Resolved Resolved Closed Closed
        121d 2h 43m 1 Henning Schmiedehausen 08/Mar/07 00:04
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12551876 ] jira [ 12552667 ]
        Mark Thomas made changes -
        Workflow jira [ 12325094 ] Default workflow, editable Closed status [ 12551876 ]
        Henning Schmiedehausen made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Hide
        Henning Schmiedehausen added a comment -

        Close all resolved issues for Engine 1.5 release.

        Show
        Henning Schmiedehausen added a comment - Close all resolved issues for Engine 1.5 release.
        Hide
        Daniel Rall added a comment -

        In the previous comment, Henning must've been referring to the commit he made in r471881. While the changes from that commit were all good improvements, they were also all internal. While it's been so long since I filed this remdiner issue for myself that I don't recall exactly what prompted it, I am sure that it was caused by the presence of ArrayList in some public API.

        Show
        Daniel Rall added a comment - In the previous comment, Henning must've been referring to the commit he made in r471881. While the changes from that commit were all good improvements, they were also all internal. While it's been so long since I filed this remdiner issue for myself that I don't recall exactly what prompted it, I am sure that it was caused by the presence of ArrayList in some public API.
        Henning Schmiedehausen made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Invalid [ 6 ]
        Hide
        Henning Schmiedehausen added a comment -

        Ok, after some debugging and code browsing, I'm a bit confused.

        The ArrayList object comes out of ASTObjectArray#value() (for the normal array case) or ASTIntegerRange#value() for the range ([1..10]) case. They both create an ArrayList object. However, the actual API is Object value(InternalContextAdapter context), so there is no guarantee that this will be any assumed type anyway.

        We do have not a single method (at least none that I could find) that returns an explicit ArrayList anywhere. We have a very very small number of explicit ArrayList variable declarations that I will change to List. But aside from that I see nothing that we could/must change for API 2.0.

        If you have more information, please reopen that issue. Thanks.

        Show
        Henning Schmiedehausen added a comment - Ok, after some debugging and code browsing, I'm a bit confused. The ArrayList object comes out of ASTObjectArray#value() (for the normal array case) or ASTIntegerRange#value() for the range ( [1..10] ) case. They both create an ArrayList object. However, the actual API is Object value(InternalContextAdapter context), so there is no guarantee that this will be any assumed type anyway. We do have not a single method (at least none that I could find) that returns an explicit ArrayList anywhere. We have a very very small number of explicit ArrayList variable declarations that I will change to List. But aside from that I see nothing that we could/must change for API 2.0. If you have more information, please reopen that issue. Thanks.
        Henning Schmiedehausen made changes -
        Fix Version/s 2.0 [ 12310291 ]
        Component/s Source [ 12310214 ]
        Bugzilla Id 24203
        Component/s Engine [ 12311337 ]
        Fix Version/s 1.5 [ 12310253 ]
        Hide
        Henning Schmiedehausen added a comment -

        Well it does return a List because ArrayList implements List. Or did I get this wrong. What method / code do you specifically refer to? It might make sense to fix that for 1.5 because if anyone really relies on the operator returning an ArrayList, they're screwed anyway.

        Show
        Henning Schmiedehausen added a comment - Well it does return a List because ArrayList implements List. Or did I get this wrong. What method / code do you specifically refer to? It might make sense to fix that for 1.5 because if anyone really relies on the operator returning an ArrayList, they're screwed anyway.
        Will Glass-Husain made changes -
        Environment Operating System: All
        Platform: All
        Operating System: All
        Platform: All
        Bugzilla Id 24203
        Description In the 1.x releases of Velocity, the list operator [] returns an ArrayList
        reference instead of a List reference. In the future (2.x), a cleaner API would
        be to return a List reference.
        In the 1.x releases of Velocity, the list operator [] returns an ArrayList
        reference instead of a List reference. In the future (2.x), a cleaner API would
        be to return a List reference.
        Assignee Velocity-Dev List [ velocity-dev@jakarta.apache.org ]
        Fix Version/s 2.0 [ 12310291 ]
        Hide
        Will Glass-Husain added a comment -

        Makes sense to me.

        Show
        Will Glass-Husain added a comment - Makes sense to me.
        Jeff Turner made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 24203 12315089
        Daniel Rall created issue -

          People

          • Assignee:
            Unassigned
            Reporter:
            Daniel Rall
          • Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development