Github user revans2 commented on the pull request:

    https://github.com/apache/storm/pull/1160#issuecomment-190779747
  
    I would prefer to see getFields inlined everywhere.  We are not saving 
enough code to really make it worth it.
    
    ```
        @Test(expected = IndexOutOfBoundsException.class)
        public void getThrowsWhenOutOfBoundsTest() {
            Fields fields = getFields(); // only has two items
            fields.get(2);
        }
    ```
    requires the comment `// only has two items` but
    
    ```
        @Test(expected = IndexOutOfBoundsException.class)
        public void getThrowsWhenOutOfBoundsTest() {
            Fields fields = new Fields("a", "b");
            fields.get(2);
        }
    ```
    
    is much more readable and needs no comment.  If getFields were a large 
method that required a lot of setup then it would be OK, but for this it is 
small enough I think it should be inlined.
    
    As for the NPE.  I don't really want to touch that code just yet.  If you 
want to file a JIRA with a reproducible use case we can look at it and see what 
ramifications a change might have.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to