flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FLINK-6943) Improve exceptions within TypeExtractionUtils#getSingleAbstractMethod
Date Mon, 19 Jun 2017 13:35:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-6943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16053993#comment-16053993
] 

ASF GitHub Bot commented on FLINK-6943:
---------------------------------------

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


> Improve exceptions within TypeExtractionUtils#getSingleAbstractMethod
> ---------------------------------------------------------------------
>
>                 Key: FLINK-6943
>                 URL: https://issues.apache.org/jira/browse/FLINK-6943
>             Project: Flink
>          Issue Type: Bug
>          Components: Core
>            Reporter: Dawid Wysakowicz
>            Assignee: Dawid Wysakowicz
>
> Exception message seems to be inexact. 
> Also if there is no SAM, sam would be null upon returning from the method.
> The suggestion from a review was to change the message and add a check (for null sam)
prior to returning.
> Another suggestion is to check if the given method is an interface, as only for interface
it is possible to pass lambda.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message