<h3 dir="auto">Environment</h3>
<ul dir="auto">
<li>Dubbo version: 2.7.3-SNAPSHOT</li>
<li>Operating System version: macOS</li>
<li>Java version: java8、java12</li>
</ul>
<h3 dir="auto">Steps to reproduce this issue</h3>
<p dir="auto">引入redis服务：<br>
在dubbo-consumer.xml中定义</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;dubbo:reference id=&quot;store&quot; interface=&quot;java.util.Map&quot; url=&quot;redis://127.0.0.1:6379&quot; /&gt;"><pre class="notranslate"><code class="notranslate">&lt;dubbo:reference id="store" interface="java.util.Map" url="redis://127.0.0.1:6379" /&gt;
</code></pre></div>
<p dir="auto">使用该服务：</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(&quot;spring/dubbo-consumer.xml&quot;);
Map map = context.getBean(&quot;store&quot;, Map.class);
map.put(&quot;test&quot;, &quot;123&quot;);
System.out.println(map.get(&quot;test&quot;));"><pre class="notranslate"><code class="notranslate">ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("spring/dubbo-consumer.xml");
Map map = context.getBean("store", Map.class);
map.put("test", "123");
System.out.println(map.get("test"));
</code></pre></div>
<p dir="auto">在<strong>java8</strong>环境下启动consumer应用<strong>一切正常</strong>。</p>
<p dir="auto">在<strong>java12</strong>环境下启动consumer应用<strong>异常</strong>，异常信息如下：</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[20/08/19 14:39:05:065 CST] main  WARN config.AbstractConfig:  [DUBBO] There's no valid metadata config found, if you are using the simplified mode of registry url, please make sure you have a metadata address configured properly., dubbo version: , current host: 192.168.0.169
[20/08/19 14:39:05:140 CST] main  INFO common.Version:  [DUBBO] No codeSource for class java.util.Map when getVersion, use default version null, dubbo version: , current host: 192.168.0.169
[20/08/19 14:39:06:183 CST] main  INFO config.AbstractConfig:  [DUBBO] Refer dubbo service java.util.Map from url redis://127.0.0.1:6379/java.util.Map?application=demo-consumer&amp;dubbo=2.0.2&amp;interface=java.util.Map&amp;lazy=false&amp;methods=getOrDefault,ofEntries,values,computeIfAbsent,replace,replaceAll,remove,put,containsValue,compute,hashCode,get,of,merge,putAll,keySet,entrySet,forEach,containsKey,clear,isEmpty,copyOf,entry,computeIfPresent,size,equals,putIfAbsent&amp;pid=15822&amp;qos-port=33333&amp;register.ip=192.168.0.169&amp;side=consumer&amp;sticky=false&amp;timestamp=1566283145066, dubbo version: , current host: 192.168.0.169
Exception in thread &quot;main&quot; org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'store': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: [source error] not available in a static method: handler
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:38)
Caused by: java.lang.RuntimeException: [source error] not available in a static method: handler
	at org.apache.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:348)
	at org.apache.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:287)
	at org.apache.dubbo.common.bytecode.Proxy.getProxy(Proxy.java:192)
	at org.apache.dubbo.common.bytecode.Proxy.getProxy(Proxy.java:66)
	at org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:35)
	at org.apache.dubbo.rpc.proxy.AbstractProxyFactory.getProxy(AbstractProxyFactory.java:68)
	at org.apache.dubbo.rpc.proxy.AbstractProxyFactory.getProxy(AbstractProxyFactory.java:37)
	at org.apache.dubbo.rpc.proxy.wrapper.StubProxyFactoryWrapper.getProxy(StubProxyFactoryWrapper.java:72)
	at org.apache.dubbo.rpc.ProxyFactory$Adaptive.getProxy(ProxyFactory$Adaptive.java)
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:433)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:329)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:250)
	at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:73)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170)
	... 6 more
Caused by: javassist.CannotCompileException: [source error] not available in a static method: handler
	at javassist.CtNewMethod.make(CtNewMethod.java:79)
	at javassist.CtNewMethod.make(CtNewMethod.java:45)
	at org.apache.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:323)
	... 19 more
Caused by: compile error: not available in a static method: handler
	at javassist.compiler.MemberCodeGen.fieldAccess(MemberCodeGen.java:1037)
	at javassist.compiler.MemberCodeGen.atFieldRead(MemberCodeGen.java:867)
	at javassist.compiler.MemberCodeGen.atMember(MemberCodeGen.java:862)
	at javassist.compiler.JvstCodeGen.atMember(JvstCodeGen.java:112)
	at javassist.compiler.ast.Member.accept(Member.java:39)
	at javassist.compiler.MemberCodeGen.atCallExpr(MemberCodeGen.java:510)
	at javassist.compiler.JvstCodeGen.atCallExpr(JvstCodeGen.java:244)
	at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)
	at javassist.compiler.CodeGen.atAssignCore(CodeGen.java:877)
	at javassist.compiler.CodeGen.atVariableAssign(CodeGen.java:810)
	at javassist.compiler.CodeGen.atDeclarator(CodeGen.java:744)
	at javassist.compiler.ast.Declarator.accept(Declarator.java:100)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:292)
	at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:274)
	at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:44)
	at javassist.compiler.Javac.compileMethod(Javac.java:169)
	at javassist.compiler.Javac.compile(Javac.java:95)
	at javassist.CtNewMethod.make(CtNewMethod.java:74)
	... 21 more
[20/08/19 14:39:06:298 CST] Thread-0  INFO support.ClassPathXmlApplicationContext: Closing org.springframework.context.support.ClassPathXmlApplicationContext@1134affc: startup date [Tue Aug 20 14:39:02 CST 2019]; root of context hierarchy
[20/08/19 14:39:06:302 CST] Thread-0  INFO support.AbstractRegistryFactory:  [DUBBO] Close all registries [], dubbo version: , current host: 192.168.0.169"><pre class="notranslate"><code class="notranslate">[20/08/19 14:39:05:065 CST] main  WARN config.AbstractConfig:  [DUBBO] There's no valid metadata config found, if you are using the simplified mode of registry url, please make sure you have a metadata address configured properly., dubbo version: , current host: 192.168.0.169
[20/08/19 14:39:05:140 CST] main  INFO common.Version:  [DUBBO] No codeSource for class java.util.Map when getVersion, use default version null, dubbo version: , current host: 192.168.0.169
[20/08/19 14:39:06:183 CST] main  INFO config.AbstractConfig:  [DUBBO] Refer dubbo service java.util.Map from url redis://127.0.0.1:6379/java.util.Map?application=demo-consumer&amp;dubbo=2.0.2&amp;interface=java.util.Map&amp;lazy=false&amp;methods=getOrDefault,ofEntries,values,computeIfAbsent,replace,replaceAll,remove,put,containsValue,compute,hashCode,get,of,merge,putAll,keySet,entrySet,forEach,containsKey,clear,isEmpty,copyOf,entry,computeIfPresent,size,equals,putIfAbsent&amp;pid=15822&amp;qos-port=33333&amp;register.ip=192.168.0.169&amp;side=consumer&amp;sticky=false&amp;timestamp=1566283145066, dubbo version: , current host: 192.168.0.169
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'store': FactoryBean threw exception on object creation; nested exception is java.lang.RuntimeException: [source error] not available in a static method: handler
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:177)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
	at org.apache.dubbo.demo.consumer.Application.main(Application.java:38)
Caused by: java.lang.RuntimeException: [source error] not available in a static method: handler
	at org.apache.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:348)
	at org.apache.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:287)
	at org.apache.dubbo.common.bytecode.Proxy.getProxy(Proxy.java:192)
	at org.apache.dubbo.common.bytecode.Proxy.getProxy(Proxy.java:66)
	at org.apache.dubbo.rpc.proxy.javassist.JavassistProxyFactory.getProxy(JavassistProxyFactory.java:35)
	at org.apache.dubbo.rpc.proxy.AbstractProxyFactory.getProxy(AbstractProxyFactory.java:68)
	at org.apache.dubbo.rpc.proxy.AbstractProxyFactory.getProxy(AbstractProxyFactory.java:37)
	at org.apache.dubbo.rpc.proxy.wrapper.StubProxyFactoryWrapper.getProxy(StubProxyFactoryWrapper.java:72)
	at org.apache.dubbo.rpc.ProxyFactory$Adaptive.getProxy(ProxyFactory$Adaptive.java)
	at org.apache.dubbo.config.ReferenceConfig.createProxy(ReferenceConfig.java:433)
	at org.apache.dubbo.config.ReferenceConfig.init(ReferenceConfig.java:329)
	at org.apache.dubbo.config.ReferenceConfig.get(ReferenceConfig.java:250)
	at org.apache.dubbo.config.spring.ReferenceBean.getObject(ReferenceBean.java:73)
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170)
	... 6 more
Caused by: javassist.CannotCompileException: [source error] not available in a static method: handler
	at javassist.CtNewMethod.make(CtNewMethod.java:79)
	at javassist.CtNewMethod.make(CtNewMethod.java:45)
	at org.apache.dubbo.common.bytecode.ClassGenerator.toClass(ClassGenerator.java:323)
	... 19 more
Caused by: compile error: not available in a static method: handler
	at javassist.compiler.MemberCodeGen.fieldAccess(MemberCodeGen.java:1037)
	at javassist.compiler.MemberCodeGen.atFieldRead(MemberCodeGen.java:867)
	at javassist.compiler.MemberCodeGen.atMember(MemberCodeGen.java:862)
	at javassist.compiler.JvstCodeGen.atMember(JvstCodeGen.java:112)
	at javassist.compiler.ast.Member.accept(Member.java:39)
	at javassist.compiler.MemberCodeGen.atCallExpr(MemberCodeGen.java:510)
	at javassist.compiler.JvstCodeGen.atCallExpr(JvstCodeGen.java:244)
	at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)
	at javassist.compiler.CodeGen.atAssignCore(CodeGen.java:877)
	at javassist.compiler.CodeGen.atVariableAssign(CodeGen.java:810)
	at javassist.compiler.CodeGen.atDeclarator(CodeGen.java:744)
	at javassist.compiler.ast.Declarator.accept(Declarator.java:100)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:292)
	at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:274)
	at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:44)
	at javassist.compiler.Javac.compileMethod(Javac.java:169)
	at javassist.compiler.Javac.compile(Javac.java:95)
	at javassist.CtNewMethod.make(CtNewMethod.java:74)
	... 21 more
[20/08/19 14:39:06:298 CST] Thread-0  INFO support.ClassPathXmlApplicationContext: Closing org.springframework.context.support.ClassPathXmlApplicationContext@1134affc: startup date [Tue Aug 20 14:39:02 CST 2019]; root of context hierarchy
[20/08/19 14:39:06:302 CST] Thread-0  INFO support.AbstractRegistryFactory:  [DUBBO] Close all registries [], dubbo version: , current host: 192.168.0.169
</code></pre></div>
<h3 dir="auto">Expected Result</h3>
<p dir="auto">java12中也能正常使用</p>
<h3 dir="auto">Actual Result</h3>
<p dir="auto">出现异常，异常信息见上文</p>
<h3 dir="auto">分析</h3>
<p dir="auto">异常原因是Dubbo在对<code class="notranslate">java.util.Map</code>进行代理时，使用javassit对每个方法进行代理，在java9之前，Map接口中是没有static方法的，而之后新增了一些static方法，现在代理逻辑里没有处理static方法的代理逻辑，导致代理时出现异常。</p>
<p dir="auto">In jdk8 the interface supports static method.<br>
The compilation of static methods should be excluded when generating the proxy.<br>
If not excluded, the following exception will be thrown：</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Caused by: compile error: not available in a static method: handler
	at javassist.compiler.MemberCodeGen.fieldAccess(MemberCodeGen.java:1037)
	at javassist.compiler.MemberCodeGen.atFieldRead(MemberCodeGen.java:867)
	at javassist.compiler.MemberCodeGen.atMember(MemberCodeGen.java:862)
	at javassist.compiler.JvstCodeGen.atMember(JvstCodeGen.java:112)
	at javassist.compiler.ast.Member.accept(Member.java:39)
	at javassist.compiler.MemberCodeGen.atCallExpr(MemberCodeGen.java:510)
	at javassist.compiler.JvstCodeGen.atCallExpr(JvstCodeGen.java:244)
	at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)
	at javassist.compiler.CodeGen.atAssignCore(CodeGen.java:877)
	at javassist.compiler.CodeGen.atVariableAssign(CodeGen.java:810)
	at javassist.compiler.CodeGen.atDeclarator(CodeGen.java:744)
	at javassist.compiler.ast.Declarator.accept(Declarator.java:100)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:292)
	at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:274)
	at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:44)
	at javassist.compiler.Javac.compileMethod(Javac.java:169)
	at javassist.compiler.Javac.compile(Javac.java:95)
	at javassist.CtNewMethod.make(CtNewMethod.java:74)"><pre class="notranslate"><code class="notranslate">Caused by: compile error: not available in a static method: handler
	at javassist.compiler.MemberCodeGen.fieldAccess(MemberCodeGen.java:1037)
	at javassist.compiler.MemberCodeGen.atFieldRead(MemberCodeGen.java:867)
	at javassist.compiler.MemberCodeGen.atMember(MemberCodeGen.java:862)
	at javassist.compiler.JvstCodeGen.atMember(JvstCodeGen.java:112)
	at javassist.compiler.ast.Member.accept(Member.java:39)
	at javassist.compiler.MemberCodeGen.atCallExpr(MemberCodeGen.java:510)
	at javassist.compiler.JvstCodeGen.atCallExpr(JvstCodeGen.java:244)
	at javassist.compiler.ast.CallExpr.accept(CallExpr.java:46)
	at javassist.compiler.CodeGen.atAssignCore(CodeGen.java:877)
	at javassist.compiler.CodeGen.atVariableAssign(CodeGen.java:810)
	at javassist.compiler.CodeGen.atDeclarator(CodeGen.java:744)
	at javassist.compiler.ast.Declarator.accept(Declarator.java:100)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atStmnt(CodeGen.java:351)
	at javassist.compiler.ast.Stmnt.accept(Stmnt.java:50)
	at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:292)
	at javassist.compiler.CodeGen.atMethodDecl(CodeGen.java:274)
	at javassist.compiler.ast.MethodDecl.accept(MethodDecl.java:44)
	at javassist.compiler.Javac.compileMethod(Javac.java:169)
	at javassist.compiler.Javac.compile(Javac.java:95)
	at javassist.CtNewMethod.make(CtNewMethod.java:74)
</code></pre></div>