You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by dawidwys <gi...@git.apache.org> on 2017/06/19 09:14:45 UTC

[GitHub] flink pull request #4140: [FLINK-6943] Improve exceptions within TypeExtract...

GitHub user dawidwys opened a pull request:

    https://github.com/apache/flink/pull/4140

    [FLINK-6943] Improve exceptions within TypeExtractionUtils#getSingleA…

    …bstractMethod
    
    Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
    If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the [How To Contribute guide](http://flink.apache.org/how-to-contribute.html).
    In addition to going through the list, please provide a meaningful description of your changes.
    
    - [ ] General
      - The pull request references the related JIRA issue ("[FLINK-XXX] Jira title text")
      - The pull request addresses only one issue
      - Each commit in the PR has a meaningful commit message (including the JIRA id)
    
    - [ ] Documentation
      - Documentation has been added for new functionality
      - Old documentation affected by the pull request has been updated
      - JavaDoc for public methods has been added
    
    - [ ] Tests & Build
      - Functionality added by the pull request is covered by tests
      - `mvn clean verify` has been executed successfully locally or a Travis build has passed


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

    $ git pull https://github.com/dawidwys/flink flink6943

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

    https://github.com/apache/flink/pull/4140.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 #4140
    
----
commit 316afb3085486186a098b4aa9607a0b269a5312b
Author: Dawid Wysakowicz <dw...@apache.org>
Date:   2017-06-19T07:38:25Z

    [FLINK-6943] Improve exceptions within TypeExtractionUtils#getSingleAbstractMethod

----


---
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] flink issue #4140: [FLINK-6943] Improve exceptions within TypeExtractionUtil...

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

    https://github.com/apache/flink/pull/4140
  
    +1.


---
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] flink issue #4140: [FLINK-6943] Improve exceptions within TypeExtractionUtil...

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

    https://github.com/apache/flink/pull/4140
  
    @zentol Are you still gonna merge it or shall I do it?


---
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] flink pull request #4140: [FLINK-6943] Improve exceptions within TypeExtract...

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

    https://github.com/apache/flink/pull/4140#discussion_r122708789
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java ---
    @@ -215,22 +215,33 @@ public static Type extractTypeArgument(Type t, int index) throws InvalidTypesExc
     	 * Extracts a Single Abstract Method (SAM) as defined in Java Specification (4.3.2. The Class Object,
     	 * 9.8 Functional Interfaces, 9.4.3 Interface Method Body) from given class.
     	 *
    -	 * @param baseClass
    -	 * @throws InvalidTypesException if the given class does not implement
    -	 * @return
    +	 * @param baseClass a class that is a FunctionalInterface to retrieve a SAM from
    +	 * @throws InvalidTypesException if the given class does not implement FunctionalInterface
    +	 * @return single abstract method of the given class
     	 */
     	public static Method getSingleAbstractMethod(Class<?> baseClass) {
    +
    +		if (!baseClass.isInterface()) {
    +			throw new InvalidTypesException("FunctionalInterface must be an interface");
    --- End diff --
    
    Yes and no, I would say. Given class must be a FunctionalInterface which implies it has to be an interface. If you feel. How about such a message: "Given class must be a FunctionalInterface which implies it has to be an interface."?


---
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] flink issue #4140: [FLINK-6943] Improve exceptions within TypeExtractionUtil...

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

    https://github.com/apache/flink/pull/4140
  
    I'm preparing a big batch that I'll merge on the weekend. I have to re-use the pull request to get a proper run on travis, but during the week there's just too much going on.


---
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] flink issue #4140: [FLINK-6943] Improve exceptions within TypeExtractionUtil...

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

    https://github.com/apache/flink/pull/4140
  
    lgtm


---
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] flink issue #4140: [FLINK-6943] Improve exceptions within TypeExtractionUtil...

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

    https://github.com/apache/flink/pull/4140
  
    merging.


---
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] flink pull request #4140: [FLINK-6943] Improve exceptions within TypeExtract...

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

    https://github.com/apache/flink/pull/4140


---
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] flink pull request #4140: [FLINK-6943] Improve exceptions within TypeExtract...

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

    https://github.com/apache/flink/pull/4140#discussion_r122707710
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java ---
    @@ -215,22 +215,33 @@ public static Type extractTypeArgument(Type t, int index) throws InvalidTypesExc
     	 * Extracts a Single Abstract Method (SAM) as defined in Java Specification (4.3.2. The Class Object,
     	 * 9.8 Functional Interfaces, 9.4.3 Interface Method Body) from given class.
     	 *
    -	 * @param baseClass
    -	 * @throws InvalidTypesException if the given class does not implement
    -	 * @return
    +	 * @param baseClass a class that is a FunctionalInterface to retrieve a SAM from
    +	 * @throws InvalidTypesException if the given class does not implement FunctionalInterface
    +	 * @return single abstract method of the given class
     	 */
     	public static Method getSingleAbstractMethod(Class<?> baseClass) {
    +
    +		if (!baseClass.isInterface()) {
    +			throw new InvalidTypesException("FunctionalInterface must be an interface");
    --- End diff --
    
    Shouldn't this say "Given class ... must be an interface."?


---
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] flink issue #4140: [FLINK-6943] Improve exceptions within TypeExtractionUtil...

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

    https://github.com/apache/flink/pull/4140
  
    Great, thanks!


---
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] flink pull request #4140: [FLINK-6943] Improve exceptions within TypeExtract...

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

    https://github.com/apache/flink/pull/4140#discussion_r122711527
  
    --- Diff: flink-core/src/main/java/org/apache/flink/api/java/typeutils/TypeExtractionUtils.java ---
    @@ -215,22 +215,33 @@ public static Type extractTypeArgument(Type t, int index) throws InvalidTypesExc
     	 * Extracts a Single Abstract Method (SAM) as defined in Java Specification (4.3.2. The Class Object,
     	 * 9.8 Functional Interfaces, 9.4.3 Interface Method Body) from given class.
     	 *
    -	 * @param baseClass
    -	 * @throws InvalidTypesException if the given class does not implement
    -	 * @return
    +	 * @param baseClass a class that is a FunctionalInterface to retrieve a SAM from
    +	 * @throws InvalidTypesException if the given class does not implement FunctionalInterface
    +	 * @return single abstract method of the given class
     	 */
     	public static Method getSingleAbstractMethod(Class<?> baseClass) {
    +
    +		if (!baseClass.isInterface()) {
    +			throw new InvalidTypesException("FunctionalInterface must be an interface");
    --- End diff --
    
    My main concern is consistency with other exception messages; they all include the base class.
    
    I would suggest "... is not a FunctionalInterface."; i don't think we need the "which implies..." bit.


---
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.
---