You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/05/16 18:25:00 UTC

[jira] [Commented] (GROOVY-8509) SC: error for call to protected method from same package

    [ https://issues.apache.org/jira/browse/GROOVY-8509?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16477858#comment-16477858 ] 

ASF GitHub Bot commented on GROOVY-8509:
----------------------------------------

GitHub user jwagenleitner opened a pull request:

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

    GROOVY-8509: SC error call to protected method from same package

    Because they were closely related, this PR also includes the following:
    
    1. A change to the fix introduced by GROOVY-7883 (b1d1232770aa) to prevent filtering protected methods in the `StaticTypeCheckingVisitor` if caller is in the same package. From the same commit, removes the test `Groovy7883Bug#test3` because it should compile and the new test introduced for GROOVY-8509 in `MethodCallsStaticCompilation` takes it place.
    
    1. A change to revert groovy.sql.Sql#asList (b1d1232770aa) back to `protected`. Fix for GROOVY-7883 enforced visibility for method calls in `TypedChecked` and `CompileStatic` modes. Test was originally put in place to verify the added ClosureParams, so changed test to access method via subclass so that the access modifier for the method can remain protected. I think the spirit of the test is preserved in this case without having to open access to the method under test.

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

    $ git pull https://github.com/jwagenleitner/groovy 8509-SC-protected-same-package

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

    https://github.com/apache/groovy/pull/707.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 #707
    
----
commit c76783966f4f9198498abdf6f4696dc36e449cd5
Author: John Wagenleitner <jw...@...>
Date:   2018-05-16T14:58:23Z

    Revert change to groovy.sql.Sql#asList in commit b1d1232770aa
    
    Fix for GROOVY-7883 enforced visibility for method calls in TypedChecked
    and CompileStatic modes. Test was originally put in place to verify
    the added ClosureParams, so changed test to access method via subclass
    so that the access modifier for the method can remain protected.

commit 8821e8406adeec4d69894b739a2d941c51266c87
Author: John Wagenleitner <jw...@...>
Date:   2018-05-16T15:34:48Z

    GROOVY-8509: SC error call to protected method from same package
    
    Also includes a change to the fix introduced by GROOVY-7883 (b1d1232770aa)
    to prevent filtering protected methods in the StaticTypeCheckingVisitor if
    caller is in the same package. From the same commit, removes the test
    Groovy7883Bug#test3 because it should compile and the new test
    introduced for GROOVY-8509 in MethodCallsStaticCompilation takes it place.

----


> SC: error for call to protected method from same package
> --------------------------------------------------------
>
>                 Key: GROOVY-8509
>                 URL: https://issues.apache.org/jira/browse/GROOVY-8509
>             Project: Groovy
>          Issue Type: Bug
>    Affects Versions: 2.5.0-beta-2, 2.6.0-alpha-3
>            Reporter: Eric Milles
>            Priority: Major
>
> Groovy 2.5+ is producing compilation errors for @CompileStatic test class calling a protected method of class under test (in same package).  This should be allowed as protected is "package-private" plus subtypes.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)