Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-1081

Weld crashes when attempting to read malformed class names

    XMLWordPrintable

Details

    • Hide

      Extract attached project, cd to groovy-closure-classname-test and run mvn test.

      Show
      Extract attached project, cd to groovy-closure-classname-test and run mvn test.

    Description

      The Groovy compiler generates invalid class names for classes representing a Groovy closure inside an inner class (see GROOVY-5351). This bug causes Weld to crash when calling WeldClassImpl.isAnonymousClass(). While Weld can't help Groovy's behaviour, it shouldn't crash either.

      The classes we have that cause this are:

      brooklyn.event.adapter.JmxNotificationAdapter$_NotificationPushHelper_closure1
      brooklyn.entity.basic.MethodEffector$_AnnotationsOnMethod_closure2
      brooklyn.entity.basic.MethodEffector$_AnnotationsOnMethod_closure1
      

      The exception that crashes Weld is:

      Caused by: java.lang.InternalError: Malformed class name
      	at java.lang.Class.getSimpleName(Class.java:1133) [:1.6.0_29]
      	at java.lang.Class.isAnonymousClass(Class.java:1188) [:1.6.0_29]
      	at org.jboss.weld.introspector.jlr.WeldClassImpl.isAnonymousClass(WeldClassImpl.java:386)
      	at org.jboss.weld.bootstrap.AbstractBeanDeployer.isTypeManagedBeanOrDecoratorOrInterceptor(AbstractBeanDeployer.java:260)
      	at org.jboss.weld.bootstrap.BeanDeployer.createBeans(BeanDeployer.java:131)
      	at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:191)
      	at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:336)
      	at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:81)
      	at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
      	... 4 more
      

      The attached project demonstrates the problem by having Weld load the following class:

      public class ClosureClassNameTest {
          private static class Inner {
              def _ = [1, 2, 3].each {}
          }
      }
      

      Attachments

        Activity

          People

            rhn-engineering-jharting Jozef Hartinger
            sjcorbett Sam Corbett (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: