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:50:00 GMT

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

ASF GitHub Bot commented on FLINK-6943:

Github user zentol commented on a diff in the pull request:

    --- 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
     	 * 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
    I would suggest "... is not a FunctionalInterface."; i don't think we need the "which
implies..." bit.

> 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

View raw message