db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matthew Adams <matt...@matthewadams.org>
Subject Re: change signatures for Java5; deprecate uncooperative APIs
Date Sun, 14 Oct 2007 15:41:19 GMT
+1.  Make sure we deprecate the old when adding the new methods.

On Oct 14, 2007, at 3:35 AM, Ilan Kirsh wrote:

> +1 add new methods that move the boolean parameter to be first and   
> change the Object[ ] to Object...; deprecate the uncooperative methods
>
> Ilan
>
> ----- Original Message ----- From: "Craig L Russell"  
> <Craig.Russell@Sun.COM>
> To: "Apache JDO project" <jdo-dev@db.apache.org>
> Sent: Saturday, October 13, 2007 2:50 AM
> Subject: VOTE: change signatures for Java5; deprecate uncooperative  
> APIs
>
>
>> This is from the discussion in https://issues.apache.org/jira/ 
>> browse/ JDO-538
>> It turns out that there are some uncooperative methods (those  
>> that  have a boolean parameter as the second parameter) that don't  
>> easily  migrate to Java 5 syntax.
>> Please vote:
>> +1 add new methods that move the boolean parameter to be first  
>> and  change the Object[ ] to Object...; deprecate the  
>> uncooperative methods
>> -1 keep the uncooperative methods as they are
>> This vote will end on Monday. Here's the discussion.
>> The compiler only autoboxes if the signature is one of the new   
>> variable-arity signatures. I took a closer look and found these   
>> signatures that can be changed to autobox, simply by changing the   
>> signature from [ ] to ...
>> The implementation would need to change the signature of the   
>> implementing class but no other changes would be needed (the type  
>> of  the argument inside the method remains e.g. Object[ ]).
>> In PersistenceManager, these methods can be redefined to use  
>> variable- arity:
>>     void deletePersistentAll (Object[] pcs);
>>     <T> T[] detachCopyAll (T[] pcs);
>>     void evictAll (Object[] pcs);
>>     Object[] getObjectsById (Object[] oids, boolean validate);
>>     void makeNontransactionalAll (Object[] pcs);
>>    <T> T[] makePersistentAll (T[] pcs);
>>     void makeTransactionalAll (Object[] pcs);
>>     void makeTransientAll (Object[] pcs);
>>     void makeTransientAll (Object[] pcs, boolean useFetchPlan);
>>     void retrieveAll (Object[] pcs, boolean useFetchPlan);
>>     void retrieveAll (Object[] pcs);
>> In Query:
>>     long deletePersistentAll (Object[] parameters);
>>     Object executeWithArray (Object[] parameters);
>> One more issue. Variable-arity only works if the variable part is  
>> the  last argument. So we either have to reorder the arguments or  
>> just not  modify the signature for the methods with extra  
>> arguments. So we either:
>> 1. Add new signatures, e.g.
>>      void makeTransientAll (boolean useFetchPlan, Object... pcs);
>>     void makeTransientAll (boolean useFetchPlan, Object... pcs);
>>     void retrieveAll (boolean useFetchPlan, Object... pcs);
>> 2. Don't change the signatures for these methods:
>>     Object[] getObjectsById (Object[] oids, boolean validate);
>>     void makeTransientAll (Object[] pcs, boolean useFetchPlan);
>>     void retrieveAll (Object[] pcs, boolean useFetchPlan);
>> Craig Russell
>> Architect, Sun Java Enterprise System http://java.sun.com/products/ 
>> jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!
>>
>


Mime
View raw message