openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rick Curtis (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (OPENJPA-1928) Resolving factory method does not allow method overriding
Date Tue, 22 Mar 2011 18:26:05 GMT

     [ https://issues.apache.org/jira/browse/OPENJPA-1928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Rick Curtis resolved OPENJPA-1928.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.2.0

Committed revision 1084280 to trunk. 

Thanks for the contribution Edward!

> Resolving factory method does not allow method overriding
> ---------------------------------------------------------
>
>                 Key: OPENJPA-1928
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-1928
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.2.1, 2.0.1
>            Reporter: Edward Sargisson
>            Assignee: Rick Curtis
>            Priority: Minor
>             Fix For: 2.2.0
>
>         Attachments: OPENJPA-1928-1.2.1.patch, OPENJPA-1928-r1061099.patch
>
>
> 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.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message