You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Alan Gates (JIRA)" <ji...@apache.org> on 2011/07/16 00:01:59 UTC

[jira] [Updated] (PIG-2053) PigInputFormat uses class.isAssignableFrom() where instanceof is more appropriate

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

Alan Gates updated PIG-2053:
----------------------------

    Status: Patch Available  (was: Open)

Submitting patch so this can get reviewed and committed.

> PigInputFormat uses class.isAssignableFrom() where instanceof is more appropriate
> ---------------------------------------------------------------------------------
>
>                 Key: PIG-2053
>                 URL: https://issues.apache.org/jira/browse/PIG-2053
>             Project: Pig
>          Issue Type: Improvement
>    Affects Versions: 0.10
>            Reporter: Woody Anderson
>            Priority: Minor
>              Labels: newbie
>             Fix For: 0.10
>
>         Attachments: 2053.patch
>
>
> This is a code style/quality improvement.
> isAssignableFrom is appropriate when the class is not known at compile type, but assignment needs to be checked.
> e.g. foo.getClass().isAssignableFrom(bar.getClass())
> but, if the class of foo is known (e.g. X.class), then instanceof is more appropriate and readable.
> i also made use of de morgan's to simply the "is combininable" boolean statement, which is hard to grok as written.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira