Groovy
  1. Groovy
  2. GROOVY-5410

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

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: groovy-runtime
    • Labels:
      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!

      1. groovy.zipx
        4 kB
        Craig Rykal

        Activity

        Craig Rykal created issue -
        Jochen Theodorou made changes -
        Field Original Value New Value
        Component/s groovy-runtime [ 16250 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12734333 ] Default workflow, editable Closed status [ 12746120 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12973774 ] Default workflow, editable Closed status [ 12980938 ]

          People

          • Assignee:
            Unassigned
            Reporter:
            Craig Rykal
          • Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:

              Development