You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@edgent.apache.org by "Cazen Lee (JIRA)" <ji...@apache.org> on 2016/03/22 05:56:25 UTC

[jira] [Resolved] (QUARKS-47) Remove unnecessary null check in ConnectorStream.split(enumClass, splitter)

     [ https://issues.apache.org/jira/browse/QUARKS-47?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Cazen Lee resolved QUARKS-47.
-----------------------------
    Resolution: Fixed

> Remove unnecessary null check in ConnectorStream.split(enumClass, splitter)
> ---------------------------------------------------------------------------
>
>                 Key: QUARKS-47
>                 URL: https://issues.apache.org/jira/browse/QUARKS-47
>             Project: Quarks
>          Issue Type: Improvement
>            Reporter: Cazen Lee
>            Assignee: Cazen Lee
>            Priority: Minor
>
> There are unnecessary null check in split method of ConnectorStream.java
> I thought there are posibillity to return a null in getEnumConstants() so created null check logic.
> {code:title=ConnectorStream.java|borderStyle=solid}
> public <E extends Enum<E>> EnumMap<E,TStream<T>> split(Class<E> enumClass, Function<T, E> splitter) {
>         E[] es = enumClass.getEnumConstants();
>         if(es == null) {
>             throw new IllegalArgumentException("Class object does not represent an enum type");
>         }
> {code}
> But the argument defined that enumClass is alway enum<E>. It's my mistake. The null checker is not necessary.
> It's simple change but create a jira issue because I believe it is important to leave a record of the changes and mapping 1-1(or 1-N) to github PR.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)