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

Groovy Generics Not Playing nice with java Proxies - java.lang.ClassCastException: $Proxy374 cannot be cast to ...

Attach filesAttach ScreenshotAdd voteVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: In Progress
    • Major
    • Resolution: Unresolved
    • None
    • None
    • groovy-runtime
    • None

    Description

      We are taking a current Spring based application and starting to introduce "Groovy" spring beans. We ran into this ClassCastException when trying to call a generic method on our Groovy bean that has been wrapped by the JdkDynamicAopProxy.

      I was able to reproduce with Java/Groovy and the base java.reflect.Proxy classes.

      Attached are all of my simple test classes that demostrate the issue as well as a Spock test(GroovyIssuesSpec.groovy) that shows the problem as well.

      We've had to create a hack to override how Spring proxies it's beans to ignore the fact that these beans are GroovyObjects(Removing GroovyObject.class from the list of proxiedInterfaces, for some reason works around the issue). The sooner we can get rid of that hack, the better.

      Thanks!

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            emilles Eric Milles
            crykal79 Craig Rykal

            Dates

              Created:
              Updated:

              Slack

                Issue deployment