java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public java.util.List SimpleGroovyBean.get$lazyloaded()'

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I'm using the new @Lazy AST transformation available in Groovy 1.6 for creating thread safe lazy loading properties . @Lazy GroovyDoc: http://groovy.codehaus.org/gapi/groovy/lang/Lazy.html , http://groovy.codehaus.org/gapi/org/codehaus/groovy/transform/LazyASTTransformation.html LazyASTTransformation source code: http://fisheye.codehaus.org/browse/groovy/branches/GROOVY_1_6_0/src/main/org/codehaus/groovy/transform/LazyASTTransformation.java?r=13570 My problem is in a Grails 1.1 application which uses Spring's BeanWrapper. I've also reported the problem to Grails JIRA (http://jira.codehaus.org/browse/GRAILS-4192). Calling BeanWrapperImpl.getPropertyDescriptors() fails with IllegalStateException. ("Unable to locate bridged method for bridge method...") in BridgeMethodResolver. The problem appears _only_ when "@Lazy volatile" is used (creates thread safe lazy initialization). A property annotated with @Lazy but without volatile succeeds. Workaround to the problem: I checked the LazyASTTransformation source code (while I was writing this issue) and happened to test adding "private" to the @Lazy volatile property (private @Lazy volatile) and that works. I've created a simple test case for this problem: SimpleGroovyBean.groovy: public class SimpleGroovyBean{ String name @Lazy volatile List lazyloaded={ ['some','items','in','the','list'] }() @Lazy List lazyloadedNoProblem={ ['no','problem'] }() private @Lazy volatile List lazyloadedVolatileNoProblem={ ['no','problem','when','private'] }() } SimpleGroovyBeanTest.groovy: import groovy.util.GroovyTestCase import junit.framework.TestCase import org.springframework.beans.BeanWrapperImpl public class SimpleGroovyBeanTest extends GroovyTestCase { public void testBeanWrapper() { def bean = new SimpleGroovyBean() def beanWrapper = new BeanWrapperImpl(bean) assertNotNull(beanWrapper.getPropertyDescriptors()) } } Stack trace: java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public java.util.List SimpleGroovyBean.get$lazyloaded()' at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:77) at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:58) at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:246) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:143) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:251) at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:258) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at SimpleGroovyBeanTest.testBeanWrapper(SimpleGroovyBeanTest.groovy:9) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:164)
    via by Lari Hotari,
  • I'm using the new @Lazy AST transformation available in Groovy 1.6 for creating thread safe lazy loading properties . @Lazy GroovyDoc: http://groovy.codehaus.org/gapi/groovy/lang/Lazy.html , http://groovy.codehaus.org/gapi/org/codehaus/groovy/transform/LazyASTTransformation.html LazyASTTransformation source code: http://fisheye.codehaus.org/browse/groovy/branches/GROOVY_1_6_0/src/main/org/codehaus/groovy/transform/LazyASTTransformation.java?r=13570 My problem is in a Grails 1.1 application which uses Spring's BeanWrapper. I've also reported the problem to Grails JIRA (http://jira.codehaus.org/browse/GRAILS-4192). Calling BeanWrapperImpl.getPropertyDescriptors() fails with IllegalStateException. ("Unable to locate bridged method for bridge method...") in BridgeMethodResolver. The problem appears _only_ when "@Lazy volatile" is used (creates thread safe lazy initialization). A property annotated with @Lazy but without volatile succeeds. Workaround to the problem: I checked the LazyASTTransformation source code (while I was writing this issue) and happened to test adding "private" to the @Lazy volatile property (private @Lazy volatile) and that works. I've created a simple test case for this problem: SimpleGroovyBean.groovy: public class SimpleGroovyBean{ String name @Lazy volatile List lazyloaded={ ['some','items','in','the','list'] }() @Lazy List lazyloadedNoProblem={ ['no','problem'] }() private @Lazy volatile List lazyloadedVolatileNoProblem={ ['no','problem','when','private'] }() } SimpleGroovyBeanTest.groovy: import groovy.util.GroovyTestCase import junit.framework.TestCase import org.springframework.beans.BeanWrapperImpl public class SimpleGroovyBeanTest extends GroovyTestCase { public void testBeanWrapper() { def bean = new SimpleGroovyBean() def beanWrapper = new BeanWrapperImpl(bean) assertNotNull(beanWrapper.getPropertyDescriptors()) } } Stack trace: java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public java.util.List SimpleGroovyBean.get$lazyloaded()' at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:77) at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:58) at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:246) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:143) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:251) at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:258) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at SimpleGroovyBeanTest.testBeanWrapper(SimpleGroovyBeanTest.groovy:9) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:164)
    via by Lari Hotari,
  • What I did is just write an unit test by both groovy and java: A java wroted super class: ------------------------------------- @RunWith(SpringJUnit4ClassRunner.class) @Transactional @TransactionConfiguration(transactionManager = "hb3TransactionManager") @ContextConfiguration(locations = { "classpath:spring/applicationContext-global.xml", "classpath:spring/applicationContext-mail.xml"}) public class AbstractErpServiceTest { protected final static String COUNTRY_ID = "CAN"; @Autowired private GeoService geoService; .... ------------------------------------ A groovy wrote subclass : ------------------------------- class ActivityManagerTest extends AbstractErpServiceTest { @Autowired private CallManager callManager ... --------------------------------------------- When I use run it in my eclipse JUnit plugin, I got the exception: like this: ---------------------------------------- 2009-11-06 15:52:25,826 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@153ca5] to prepare test instance [com.oppa.crm.test.service.ActivityManagerTest@1c8f5b9] java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public void com.oppa.crm.test.service.ActivityManagerTest.this$dist$set$3(java.lang.String,java.lang.Object)' at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:77) [org.springframework.core-3.0.0.RC1.jar:3.0.0.RC1] --------------------------------------------------- Actually, I works before when I use the plugin with groovy 1.6.4, but after I update to 1.6.5 or 1.7, I got these exceptions. Summary, groovy unit text cannot work with these together now: @RunWith(SpringJUnit4ClassRunner.class) @Transactional @TransactionConfiguration @ContextConfiguration Hope anyone here could help me, thanks.
    via by Lei Zhang,
  • What I did is just write an unit test by both groovy and java: A java wroted super class: ------------------------------------- @RunWith(SpringJUnit4ClassRunner.class) @Transactional @TransactionConfiguration(transactionManager = "hb3TransactionManager") @ContextConfiguration(locations = { "classpath:spring/applicationContext-global.xml", "classpath:spring/applicationContext-mail.xml"}) public class AbstractErpServiceTest { protected final static String COUNTRY_ID = "CAN"; @Autowired private GeoService geoService; .... ------------------------------------ A groovy wrote subclass : ------------------------------- class ActivityManagerTest extends AbstractErpServiceTest { @Autowired private CallManager callManager ... --------------------------------------------- When I use run it in my eclipse JUnit plugin, I got the exception: like this: ---------------------------------------- 2009-11-06 15:52:25,826 [main] ERROR org.springframework.test.context.TestContextManager - Caught exception while allowing TestExecutionListener [org.springframework.test.context.support.DependencyInjectionTestExecutionListener@153ca5] to prepare test instance [com.oppa.crm.test.service.ActivityManagerTest@1c8f5b9] java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public void com.oppa.crm.test.service.ActivityManagerTest.this$dist$set$3(java.lang.String,java.lang.Object)' at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:77) [org.springframework.core-3.0.0.RC1.jar:3.0.0.RC1] --------------------------------------------------- Actually, I works before when I use the plugin with groovy 1.6.4, but after I update to 1.6.5 or 1.7, I got these exceptions. Summary, groovy unit text cannot work with these together now: @RunWith(SpringJUnit4ClassRunner.class) @Transactional @TransactionConfiguration @ContextConfiguration Hope anyone here could help me, thanks.
    via by Lei Zhang,
    • java.lang.IllegalStateException: Unable to locate bridged method for bridge method 'public java.util.List SimpleGroovyBean.get$lazyloaded()' at org.springframework.core.BridgeMethodResolver.findBridgedMethod(BridgeMethodResolver.java:77) at org.springframework.beans.GenericTypeAwarePropertyDescriptor.<init>(GenericTypeAwarePropertyDescriptor.java:58) at org.springframework.beans.CachedIntrospectionResults.<init>(CachedIntrospectionResults.java:246) at org.springframework.beans.CachedIntrospectionResults.forClass(CachedIntrospectionResults.java:143) at org.springframework.beans.BeanWrapperImpl.getCachedIntrospectionResults(BeanWrapperImpl.java:251) at org.springframework.beans.BeanWrapperImpl.getPropertyDescriptors(BeanWrapperImpl.java:258) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite$PojoCachedMethodSiteNoUnwrapNoCoerce.invoke(PojoMetaMethodSite.java:229) at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:52) at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:43) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116) at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120) at SimpleGroovyBeanTest.testBeanWrapper(SimpleGroovyBeanTest.groovy:9) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at junit.framework.TestCase.runTest(TestCase.java:164)
    No Bugmate found.