You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by "James Grahn (JIRA)" <ji...@apache.org> on 2010/12/14 18:55:02 UTC

[jira] Created: (RIVER-384) Generic method usage in Spaces API

Generic method usage in Spaces API
----------------------------------

                 Key: RIVER-384
                 URL: https://issues.apache.org/jira/browse/RIVER-384
             Project: River
          Issue Type: Improvement
          Components: com_sun_jini_outrigger, net_jini_space
            Reporter: James Grahn
            Priority: Minor


Use generics in the method signatures to minimize casting, in this manner:

public <T extends Entry> T read(T template, Transaction txn, long timeout)

(Similar transforms could be made to the majority of the methods within Javaspace.)

The generic is defined at the method-level, enforcing that the type returned is the type of the template (and that template extends Entry).   

This is precisely the current contractual obligation of the method.

This would have the following benefits:
1) Users no longer have to cast everything they receive from a read or take method.
2) The compiler can enforce part of the contract that was previously only covered by documentation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (RIVER-384) Generic method usage in Spaces API

Posted by jg...@simulexinc.com.
Quite on the ball, Sim.

I anticipate Wade will submit a patch as well, and we'll then create a best-of-breed.

jamesG

-----Original Message-----
From: "Sim IJskes - QCG" <si...@qcg.nl>
Sent: Wednesday, December 29, 2010 6:26am
To: river-dev@incubator.apache.org
Subject: Re: [jira] Updated: (RIVER-384) Generic method usage in Spaces API

On 29-12-10 08:25, James Grahn (JIRA) wrote:
>
>       [ https://issues.apache.org/jira/browse/RIVER-384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> James Grahn updated RIVER-384:
> ------------------------------
>
>      Attachment: javaspace-generics-patch.txt

Created skunk/generics. Applied patch. Created job 
River-verify-generics, derived from River-verify.

Gr. Sim




Re: [jira] Updated: (RIVER-384) Generic method usage in Spaces API

Posted by Sim IJskes - QCG <si...@qcg.nl>.
On 29-12-10 08:25, James Grahn (JIRA) wrote:
>
>       [ https://issues.apache.org/jira/browse/RIVER-384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
>
> James Grahn updated RIVER-384:
> ------------------------------
>
>      Attachment: javaspace-generics-patch.txt

Created skunk/generics. Applied patch. Created job 
River-verify-generics, derived from River-verify.

Gr. Sim


[jira] Updated: (RIVER-384) Generic method usage in Spaces API

Posted by "James Grahn (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/RIVER-384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

James Grahn updated RIVER-384:
------------------------------

    Attachment: javaspace-generics-patch.txt

First draft of a patch to utilize generics in the Javaspace API.

Previously, it was suggested that a change like this may occur in a different service, rather than the Javaspace API, so this patch should be considered only proof-of-concept.

Future revisions might be forthcoming as discussion or testing reveals a need.

> Generic method usage in Spaces API
> ----------------------------------
>
>                 Key: RIVER-384
>                 URL: https://issues.apache.org/jira/browse/RIVER-384
>             Project: River
>          Issue Type: Improvement
>          Components: com_sun_jini_outrigger, net_jini_space
>            Reporter: James Grahn
>            Priority: Minor
>         Attachments: javaspace-generics-patch.txt
>
>
> Use generics in the method signatures to minimize casting, in this manner:
> public <T extends Entry> T read(T template, Transaction txn, long timeout)
> (Similar transforms could be made to the majority of the methods within Javaspace.)
> The generic is defined at the method-level, enforcing that the type returned is the type of the template (and that template extends Entry).   
> This is precisely the current contractual obligation of the method.
> This would have the following benefits:
> 1) Users no longer have to cast everything they receive from a read or take method.
> 2) The compiler can enforce part of the contract that was previously only covered by documentation.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.