flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zentol <...@git.apache.org>
Subject [GitHub] flink pull request #4140: [FLINK-6943] Improve exceptions within TypeExtract...
Date Mon, 19 Jun 2017 13:49:50 GMT
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.
---

Mime
View raw message