You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by danielsun1106 <gi...@git.apache.org> on 2018/05/12 05:10:27 UTC

[GitHub] groovy pull request #705: GROOVY-7883 Static compiler prefers private constr...

GitHub user danielsun1106 opened a pull request:

    https://github.com/apache/groovy/pull/705

    GROOVY-7883  Static compiler prefers private constructor over public …

    …if private matches be

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/danielsun1106/groovy GROOVY-7883

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/groovy/pull/705.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #705
    
----
commit 394db983d51446f849205efc4f9cca21601cc47c
Author: Daniel Sun <re...@...>
Date:   2018-05-12T04:35:01Z

    GROOVY-7883  Static compiler prefers private constructor over public if private matches be

----


---

[GitHub] groovy pull request #705: GROOVY-7883 Static compiler prefers private constr...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/groovy/pull/705


---

[GitHub] groovy pull request #705: GROOVY-7883 Static compiler prefers private constr...

Posted by danielsun1106 <gi...@git.apache.org>.
Github user danielsun1106 commented on a diff in the pull request:

    https://github.com/apache/groovy/pull/705#discussion_r187764707
  
    --- Diff: subprojects/groovy-sql/src/main/java/groovy/sql/Sql.java ---
    @@ -3973,7 +3973,7 @@ protected final ResultSet executePreparedQuery(String sql, List<Object> params)
          * @return the resulting list of rows
          * @throws SQLException if a database error occurs
          */
    -    protected List<GroovyRowResult> asList(String sql, ResultSet rs,
    +    public List<GroovyRowResult> asList(String sql, ResultSet rs,
    --- End diff --
    
    The test accesses the `protected` method `asList`, which is not allowed. so I change its visibility to `public`.
    groovy.sql.SqlSTCTest#testAsList
    ```
        void testAsList() {
            shell.evaluate '''
                def test(groovy.sql.Sql sql, java.sql.ResultSet rs) { 
                    sql.asList('SELECT * FROM FOO', rs) { println it.columnCount } 
                }
            '''
        }
    ```


---