db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject VOTE: change signatures for Java5; deprecate uncooperative APIs
Date Sat, 13 Oct 2007 00:50:42 GMT
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