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

Groovy Reflection problem for unknown classes

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.0-JSR-3
    • Component/s: Groovlet / GSP
    • Labels:
      None

      Description

      Groovy can't reflect classes which are unknown to the its ClassLoader when using MetaClass.setUseReflection(false) even if it could cast to a known interface.

      For example Tomcat will replace System.out with a custom PrintStream instead of the default and when you try to use System.out and setUseReflection is set to false every call to System.out will fail with:

      java.lang.NoClassDefFoundError: org/apache/tomcat/util/log/SystemLogHandler
      gjdk.org.apache.tomcat.util.log.SystemLogHandler_GroovyReflector.invoke(SystemLogHandler_GroovyReflector.java)
      groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
      groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:996)

      I packaged a complete war file to show the behaviour.

      It can be found at http://home.mx4k.com/test.war

      You should be able to call: http://yourhost/test/test.groovy to see the problem. If you use the default groovy.servlet.GroovyServlet the example works but I couldn't come up with an "easier" test to show this behaviour.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                blackdrag Jochen Theodorou
                Reporter:
                maniax Thomas Heller
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: