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

    https://github.com/apache/metamodel/pull/57#discussion_r41483028
  
    --- Diff: jdbc/src/main/java/org/apache/metamodel/jdbc/JdbcDataContext.java 
---
    @@ -336,6 +336,13 @@ public DataSet executeQuery(CompiledQuery 
compiledQuery, Object... values) {
     
         private DataSet execute(Connection connection, Query query, Statement 
statement, JdbcCompiledQuery compiledQuery,
                 JdbcCompiledQueryLease lease, Object[] values) throws 
SQLException, MetaModelException {
    +        Integer maxRows = query.getMaxRows();
    +
    +        final List<SelectItem> selectItems = 
query.getSelectClause().getItems();
    +        if (maxRows != null && maxRows.intValue() == 0) {
    --- End diff --
    
    Actually it is IMO :-) Imagine it says
    ```
    if (maxRows != null && maxRows == 0) {
    ```
    Then the next guy that reads this code will think that it's a needless null 
check because
    ```
    if (maxRows == 0) {
    ```
    looks like it does the exact same thing. But in fact since it may be null 
the unboxing is not problem-free. So I would prefer to make it explicit so that 
you see a method being called on the potentially-null variable 'maxRows'.


---
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