You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@geode.apache.org by micro9110 <gi...@git.apache.org> on 2016/12/17 03:10:53 UTC

[GitHub] geode pull request #321: [GEODE-1577] Unhelpful generic types on Execution.e...

GitHub user micro9110 opened a pull request:

    https://github.com/apache/geode/pull/321

    [GEODE-1577] Unhelpful generic types on Execution.execute

    1. Replaced the execute methods of the function service Execution class returning a ResultCollector with wildcards with generic types.
    2. Modified the related classes using this method with explicit type casting to use the method with generic type.
    
    JIRA 
    https://issues.apache.org/jira/browse/GEODE-1577


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/micro9110/incubator-geode feature/GEODE-1577

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/geode/pull/321.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #321
    
----
commit 4b480710b01081cc4eb2911392ad6f0c3da86cbb
Author: Alyssa Kim <mi...@gmail.com>
Date:   2016-12-13T02:49:25Z

    GEODE-1577: Unhelpful generic types on Execution.execute
     Replaced wildcards with <T, S> for non-deprecated Execution.execute methods.

commit d70a0e3f3cf558bd4e2828c118382eaea465fc77
Author: Alyssa Kim <mi...@gmail.com>
Date:   2016-12-17T02:31:31Z

    GEODE-1577: Unhelpful generic types on Execution.execute
    
    Fixed Execute.execute in classes that use this method to Execute.<T, S>execute,
    and removed explicit casting.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode issue #321: [GEODE-1577] Unhelpful generic types on Execution.execute

Posted by micro9110 <gi...@git.apache.org>.
Github user micro9110 commented on the issue:

    https://github.com/apache/geode/pull/321
  
    I added the descriptions, but I am not sure if they are descriptive enough to not confuse the users. Please let me know if there is any better description. 
    Thanks for the code-review :)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode issue #321: [GEODE-1577] Unhelpful generic types on Execution.execute

Posted by kirklund <gi...@git.apache.org>.
Github user kirklund commented on the issue:

    https://github.com/apache/geode/pull/321
  
    +1 Dan's latest suggestion sounds good to me.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode issue #321: [GEODE-1577] Unhelpful generic types on Execution.execute

Posted by upthewaterspout <gi...@git.apache.org>.
Github user upthewaterspout commented on the issue:

    https://github.com/apache/geode/pull/321
  
    Hi all,
    
    I'm really sorry I missed this. I was out of town for a while and somehow the discussion slipped through the cracks when I was catching up.
    
    These changes are what I had in mind, but I didn't realize that this would break existing code that was doing a cast. I know adding a generics should be safe, but in this case we're fixing generics that are broken which is why I think we are getting into trouble.
    
    I did a little messing around. It looks like we might be able to get away with adding generics to Execution. 
    The only caveat is that once we add generics to Execution we are stuck with them. There is an existing bug to also add an argument type to the FunctionContext - see GEODE-2217. So I think maybe the thing to do is to add three types parameters to execution. Something like this:
    
    ```
    /**
     *
     * @param <IN> The type of the argument passed into the function, if any
     * @param <OUT The type of results sent by the function
     * @param <AGG> The type of the aggregrated result returned by the ResultCollector
     */
    public interface Execution<IN, OUT,AGG> {
      Execution<IN, OUT, AGG> withArgs(IN args);
      ResultCollector<OUT, AGG> execute(...)
    }
    ```
    
    What do you think? The other option I suppose is to deprecate the Execution class and introduce a new one, or deprecate the execute methods and introduce new ones, but that seems painful.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode issue #321: [GEODE-1577] Unhelpful generic types on Execution.execute

Posted by upthewaterspout <gi...@git.apache.org>.
Github user upthewaterspout commented on the issue:

    https://github.com/apache/geode/pull/321
  
    +1 these latest changes look good to me!


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode pull request #321: [GEODE-1577] Unhelpful generic types on Execution.e...

Posted by metatype <gi...@git.apache.org>.
Github user metatype commented on a diff in the pull request:

    https://github.com/apache/geode/pull/321#discussion_r93150247
  
    --- Diff: geode-core/src/main/java/org/apache/geode/distributed/internal/deadlock/GemFireDeadlockDetector.java ---
    @@ -97,7 +97,7 @@ public void clearResults() {
     
         ((AbstractExecution) execution).setIgnoreDepartedMembers(true);
         collector = (ResultCollector<HashSet<Dependency>, Serializable>) execution
    --- End diff --
    
    You can remove the cast here as you've done in the other places.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode issue #321: [GEODE-1577] Unhelpful generic types on Execution.execute

Posted by kirklund <gi...@git.apache.org>.
Github user kirklund commented on the issue:

    https://github.com/apache/geode/pull/321
  
    @dalyssakim @metatype @upthewaterspout GEODE-1577 is interesting because Dan labelled it "starter" which would imply that a new contributor should be able to pick it up and run with it without having a dev-list discussion about public API changes. I'm curious what Dan's expectation was in comparison to Anthony's feedback -- it looks like Alyssa's changes are exactly what Dan had in mind. Let's see what Dan's feedback is (he may be on holiday leave right now).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode issue #321: [GEODE-1577] Unhelpful generic types on Execution.execute

Posted by jhuynh1 <gi...@git.apache.org>.
Github user jhuynh1 commented on the issue:

    https://github.com/apache/geode/pull/321
  
    I've pulled these changes in.  Had to resolve some conflicts but these changes should be in geode now.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode pull request #321: [GEODE-1577] Unhelpful generic types on Execution.e...

Posted by metatype <gi...@git.apache.org>.
Github user metatype commented on a diff in the pull request:

    https://github.com/apache/geode/pull/321#discussion_r93149349
  
    --- Diff: geode-core/src/main/java/org/apache/geode/cache/execute/Execution.java ---
    @@ -89,7 +89,7 @@
        * 
        * @since GemFire 6.0
        */
    -  public ResultCollector<?, ?> execute(String functionId) throws FunctionException;
    +  public <T, S> ResultCollector<T, S> execute(String functionId) throws FunctionException;
    --- End diff --
    
    Since this is a public API, you should describe the params in javadoc when it's not obvious what T and S refer to.  You can use the `@param` tag as seen in [1].
    
    [1] https://github.com/apache/geode/blob/8bf39571471642beaaa36c9626a61a90bd3803c2/geode-core/src/main/java/org/apache/geode/cache/snapshot/RegionSnapshotService.java



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] geode pull request #321: [GEODE-1577] Unhelpful generic types on Execution.e...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/geode/pull/321


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---