Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-8144

Invoking a public method declared in a non-public class result in a IllegalAccessError

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.5.0-alpha-1
    • Fix Version/s: 2.5.0-beta-1
    • Component/s: Static compilation
    • Labels:
      None

      Description

      For example:

      import groovyx.gpars.agent.Agent
      import groovy.transform.CompileStatic
      
      @CompileStatic
      class Dummy {
      
        def void foo() {
           def x = new Agent<List>( [] )
           x.send { List it -> it.add(1) }
           x.await()
        }
      
      }
      
      
      new Dummy().foo()
      
      
      java.lang.IllegalAccessError: tried to access class groovyx.gpars.agent.AgentBase from class Dummy
          at Dummy.foo(ConsoleScript15:10)
          at Dummy$foo.call(Unknown Source)
          at ConsoleScript15.run(ConsoleScript15:16)
      

      I guess the problem is that AgentBase class is not declared public
      https://github.com/GPars/GPars/blob/master/src/main/groovy/groovyx/gpars/agent/AgentBase.java#L34

      This is a regression, see also this thread https://groups.google.com/d/msg/groovy-user/0Ig9mhRLnKk/LWsx1EQbu_4J

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          GitHub user jwagenleitner opened a pull request:

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

          GROOVY-8144: Invoking a public method declared in a non-public class …

          …result in a IllegalAccessError

          Commit 1a4c9918a4f12e64 introduced the DecompiledClassNode as part of
          enabling the ASM class resolver.

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

          $ git pull https://github.com/jwagenleitner/groovy groovy8144

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

          https://github.com/apache/groovy/pull/522.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 #522


          commit 3b6c2a504119e99d86de76019f48e0059b8fcf9e
          Author: John Wagenleitner <jwagenleitner@apache.org>
          Date: 2017-04-10T20:10:25Z

          GROOVY-8144: Invoking a public method declared in a non-public class result in a IllegalAccessError

          Commit 1a4c9918a4f12e64 introduced the DecompiledClassNode as part of
          enabling the ASM class resolver.


          Show
          githubbot ASF GitHub Bot added a comment - GitHub user jwagenleitner opened a pull request: https://github.com/apache/groovy/pull/522 GROOVY-8144 : Invoking a public method declared in a non-public class … …result in a IllegalAccessError Commit 1a4c9918a4f12e64 introduced the DecompiledClassNode as part of enabling the ASM class resolver. You can merge this pull request into a Git repository by running: $ git pull https://github.com/jwagenleitner/groovy groovy8144 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/522.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 #522 commit 3b6c2a504119e99d86de76019f48e0059b8fcf9e Author: John Wagenleitner <jwagenleitner@apache.org> Date: 2017-04-10T20:10:25Z GROOVY-8144 : Invoking a public method declared in a non-public class result in a IllegalAccessError Commit 1a4c9918a4f12e64 introduced the DecompiledClassNode as part of enabling the ASM class resolver.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/522
          Hide
          jwagenleitner John Wagenleitner added a comment -

          Thanks for reporting the issue.

          Show
          jwagenleitner John Wagenleitner added a comment - Thanks for reporting the issue.

            People

            • Assignee:
              jwagenleitner John Wagenleitner
              Reporter:
              pablo72 paolo di tommaso
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development