OpenJPA
  1. OpenJPA
  2. OPENJPA-1928

Resolving factory method does not allow method overriding

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.1, 2.0.1
    • Fix Version/s: 2.2.0
    • Component/s: kernel
    • Labels:
      None
    • Patch Info:
      Patch Available

      Description

      If a get method is annotated with @Factory then the method cannot be overridden with a method which take different parameters. The system randomly selects one of the several methods with the same name which may or may not take the type which will be provided.

      For example:
      @Persistent(optional = false)
      @Column(name = "STATUS")
      @Externalizer("getName")
      @Factory("valueOf")
      public OrderStatus getStatus()

      { return this.status; }

      public class OrderStatus {
      public static OrderStatus valueOf(final int ordinal)

      { return valueOf(ordinal, OrderStatus.class); }

      public static OrderStatus valueOf(final String name)

      { return valueOf(name, OrderStatus.class); }

      }

      Actual results:
      valueOf(String) may or may not be selected.

      Expected results:
      valueOf(String) should always be selected.

      The provided patches fix this defect by applying the method invocation conversion rules from the Java Language Specification, 3rd Ed. This means that widening primitive, boxing and unboxing conversions are all respected.

      1. OPENJPA-1928-1.2.1.patch
        22 kB
        Edward Sargisson
      2. OPENJPA-1928-r1061099.patch
        22 kB
        Edward Sargisson

        Activity

        Edward Sargisson created issue -
        Edward Sargisson made changes -
        Field Original Value New Value
        Patch Info [Patch Available]
        Edward Sargisson made changes -
        Attachment OPENJPA-1928-1.2.1.patch [ 12468923 ]
        Attachment OPENJPA-1928-r1061099.patch [ 12468924 ]
        Rick Curtis made changes -
        Assignee Rick Curtis [ curtisr7 ]
        Hide
        Rick Curtis added a comment -

        Committed revision 1084280 to trunk.

        Thanks for the contribution Edward!

        Show
        Rick Curtis added a comment - Committed revision 1084280 to trunk. Thanks for the contribution Edward!
        Rick Curtis made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.2.0 [ 12315910 ]
        Resolution Fixed [ 1 ]
        Hide
        Albert Lee added a comment -

        Close issue in preparation for 2.2.0 release.

        Show
        Albert Lee added a comment - Close issue in preparation for 2.2.0 release.
        Albert Lee made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        60d 18h 40m 1 Rick Curtis 22/Mar/11 18:24
        Resolved Resolved Closed Closed
        316d 22h 40m 1 Albert Lee 02/Feb/12 17:05

          People

          • Assignee:
            Rick Curtis
            Reporter:
            Edward Sargisson
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development