title: "Illegal use of nonvirtual function call" when using Betamax
body: <p>I'm trying to set up Betamax in a Spring Boot application, but when I run my test, I get this error:</p>
  
  <pre><code>(class: co/freeside/betamax/proxy/jetty/BetamaxProxy, method: super$3$getBean signature: (Ljava/lang/Class;)Ljava/lang/Object;) Illegal use of nonvirtual function call
  java.lang.VerifyError: (class: co/freeside/betamax/proxy/jetty/BetamaxProxy, method: super$3$getBean signature: (Ljava/lang/Class;)Ljava/lang/Object;) Illegal use of nonvirtual function call
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:264)
    at co.freeside.betamax.proxy.jetty.ProxyServer.class$(ProxyServer.groovy)
    at co.freeside.betamax.proxy.jetty.ProxyServer.$get$$class$co$freeside$betamax$proxy$jetty$BetamaxProxy(ProxyServer.groovy)
    at co.freeside.betamax.proxy.jetty.ProxyServer.start(ProxyServer.groovy:47)
    at co.freeside.betamax.HttpInterceptor$start.call(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:112)
    at co.freeside.betamax.Recorder.startProxy(Recorder.groovy:198)
    at co.freeside.betamax.Recorder.this$2$startProxy(Recorder.groovy)
    at co.freeside.betamax.Recorder$this$2$startProxy.callCurrent(Unknown Source)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:145)
    at co.freeside.betamax.Recorder.withTape(Recorder.groovy:167)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:324)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1207)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN(ScriptBytecodeAdapter.java:80)
    at co.freeside.betamax.Recorder.this$dist$invoke$2(Recorder.groovy)
    at co.freeside.betamax.Recorder$1.methodMissing(Recorder.groovy)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:90)
    at groovy.lang.MetaClassImpl.invokeMissingMethod(MetaClassImpl.java:933)
    at groovy.lang.MetaClassImpl.invokePropertyOrMissing(MetaClassImpl.java:1256)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1209)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1016)
    at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:66)
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:49)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:133)
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:149)
    at co.freeside.betamax.Recorder$1.evaluate(Recorder.groovy:185)
    at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:73)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:217)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:83)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
    at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:68)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:163)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:86)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:49)
    at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69)
    at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32)
    at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93)
    at com.sun.proxy.$Proxy2.processTestClass(Unknown Source)
    at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:105)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35)
    at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24)
    at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:360)
    at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
  </code></pre>
  
  <p>If it helps at all, my Gradle file includes these dependencies:</p>
  
  <pre><code>dependencies {
      testCompile 'org.springframework.boot:spring-boot-starter-test:1.2.1.RELEASE'
      testCompile 'co.freeside:betamax:1.1.2'
      compile 'org.springframework.boot:spring-boot-starter-log4j2:1.2.1.RELEASE'
      compile 'org.springframework.boot:spring-boot-starter-web:1.2.1.RELEASE'
      compile 'org.springframework.boot:spring-boot-starter-data-jpa:1.2.1.RELEASE'
      compile 'org.springframework.boot:spring-boot-starter-tomcat:1.2.1.RELEASE'
      compile 'org.apache.tomcat.embed:tomcat-embed-jasper'
      compile 'com.domingosuarez.boot:spring-boot-starter-jade4j:0.2'
      compile 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.4.0'
      compile 'com.mashape.unirest:unirest-java:1.4.5'
      compile 'org.codehaus.groovy:groovy-all'
      compile 'org.eclipse.jetty:jetty-server'
      compile 'org.eclipse.jetty:jetty-util'
      compile 'org.eclipse.jetty:jetty-xml'
      compile 'org.eclipse.jetty:jetty-deploy'
      runtime 'javax.servlet:jstl'
      runtime 'mysql:mysql-connector-java:5.1.34'
      runtime 'net.kencochrane.raven:raven-log4j2:6.0.0'
  }
  </code></pre>
  
  <p>I'm using IntelliJ on a Mac. I tried adding <code>-Xverify:none</code> to my <code>~/Library/Preferences/IntelliJIdea14/idea.vmoptions</code> file after reading <a href="https://stackoverflow.com/questions/20976715/difficulty-running-grails-tests-in-intellij-illegal-use-of-nonvirtual-function">this post</a>, but it didn't help.</p>
  
  <p>I'd greatly appreciate any help.</p>