{"action":"closed","issue":{"url":"https://api.github.com/repos/brianoliver/migration/issues/22","repository_url":"https://api.github.com/repos/brianoliver/migration","labels_url":"https://api.github.com/repos/brianoliver/migration/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/brianoliver/migration/issues/22/comments","events_url":"https://api.github.com/repos/brianoliver/migration/issues/22/events","html_url":"https://github.com/brianoliver/migration/issues/22","id":153328910,"number":22,"title":"Cannot use Strings as return value for DeferredAssert","user":{"login":"brianoliver","id":2628293,"avatar_url":"https://avatars.githubusercontent.com/u/2628293?v=3","gravatar_id":"","url":"https://api.github.com/users/brianoliver","html_url":"https://github.com/brianoliver","followers_url":"https://api.github.com/users/brianoliver/followers","following_url":"https://api.github.com/users/brianoliver/following{/other_user}","gists_url":"https://api.github.com/users/brianoliver/gists{/gist_id}","starred_url":"https://api.github.com/users/brianoliver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brianoliver/subscriptions","organizations_url":"https://api.github.com/users/brianoliver/orgs","repos_url":"https://api.github.com/users/brianoliver/repos","events_url":"https://api.github.com/users/brianoliver/events{/privacy}","received_events_url":"https://api.github.com/users/brianoliver/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/brianoliver/migration/labels/Bug","name":"Bug","color":"b2fff6"},{"url":"https://api.github.com/repos/brianoliver/migration/labels/Major","name":"Major","color":"7aa1d3"},{"url":"https://api.github.com/repos/brianoliver/migration/labels/Module:%20Core","name":"Module: Core","color":"25ed5e"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-05-05T21:20:42Z","updated_at":"2016-05-05T21:20:42Z","closed_at":"2016-05-05T21:20:42Z","body":"Attempting a DeferredAssert on a method that returns String\n\nDeferredAssert.assertThat(eventually(invoking(bean).getState()), is(STATE_SUSPENDED));\n\nGives the following exception:\n\n   [junit] java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.String\n[junit] \tat net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)\n[junit] \tat net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)\n[junit] Exception in thread \"Thread-21\" java.lang.IllegalArgumentException: Cannot subclass final class class java.lang.String\n[junit] \tat net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)\n[junit] \tat net.sf.cglib.proxy.Enhancer.generateClass(Enhancer.java:446)\n[junit] \tat net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)\n[junit] \tat net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)\n[junit] \tat net.sf.cglib.core.DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)\n[junit] \tat com.oracle.tools.util.ReflectionHelper.createProxyOf(ReflectionHelper.java:271)\n[junit] \tat net.sf.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:216)\n[junit] \tat com.oracle.tools.deferred.DeferredHelper$DeferredMethodInteceptor.intercept(DeferredHelper.java:500)\n[junit] \tat net.sf.cglib.proxy.Enhancer.createHelper(Enhancer.java:377)\n[junit] \tat federation.SimpleMBeanTests$ParticipantBean$$EnhancerByCGLIB$$56ea8b9a.getState(<generated>)\n[junit] \tat net.sf.cglib.proxy.Enhancer.createClass(Enhancer.java:317)\n[junit] \tat federation.SimpleMBeanTests$SuspendingLoader.checkParticipantSuspend(SimpleMBeanTests.java:210)\n[junit] \tat com.oracle.tools.util.ReflectionHelper.createProxyOf(ReflectionHelper.java:271)\n[junit] \tat federation.SimpleMBeanTests$SuspendingLoader$1.run(SimpleMBeanTests.java:165)\n[junit] \tat com.oracle.tools.deferred.DeferredHelper$DeferredMethodInteceptor.intercept(DeferredHelper.java:500)\n[junit] \tat java.lang.Thread.run(Thread.java:680)\n[junit] \tat federation.SimpleMBeanTests$ParticipantBean$$EnhancerByCGLIB$$56ea8b9a.getState(<generated>)\n[junit] \tat federation.SimpleMBeanTests$SuspendingLoader.checkParticipantSuspend(SimpleMBeanTests.java:210)\n[junit] \tat federation.SimpleMBeanTests$SuspendingLoader$1.run(SimpleMBeanTests.java:165)\n[junit] \tat java.lang.Thread.run(Thread.java:680)\n\nI suspect the problem is in DeferredHelper.intercept(). In there we check for all of the built in Java types and primitives and return \"default\" values while waiting for the method invocation to return. However we are missing String.class as one of the \"known\" types so we end up trying to create a proxy of String which isn't allowed because String is final."}}