{"record":{"id":"06a9b13e046ee92c","repo":"apache/dubbo","slug":"method-unimplemented","errorCode":null,"errorMessage":"Method [{}] unimplemented.","messagePattern":"Method \\[(.+?)\\] unimplemented\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java","lineNumber":44,"sourceCode":"import java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.WeakHashMap;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport static org.apache.dubbo.common.constants.CommonConstants.MAX_PROXY_COUNT;\n\n/**\n * Proxy.\n */\npublic class Proxy {\n    public static final InvocationHandler THROW_UNSUPPORTED_INVOKER = new InvocationHandler() {\n        @Override\n        public Object invoke(Object proxy, Method method, Object[] args) {\n            throw new UnsupportedOperationException(\"Method [\" + ReflectUtils.getName(method) + \"] unimplemented.\");\n        }\n    };\n\n    private static final AtomicLong PROXY_CLASS_COUNTER = new AtomicLong(0);\n    private static final Map<ClassLoader, Map<String, Proxy>> PROXY_CACHE_MAP = new WeakHashMap<>();\n\n    private final Class<?> classToCreate;\n\n    protected Proxy(Class<?> classToCreate) {\n        this.classToCreate = classToCreate;\n    }\n\n    /**\n     * Get proxy.\n     *\n     * @param ics interface class array.\n     * @return Proxy instance.\n     */","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Proxy.java#L26-L62","documentation":"Thrown by the default InvocationHandler THROW_UNSUPPORTED_INVOKER. Proxy.newInstance() (no-arg) wires this handler into the generated proxy, so any method call on the resulting instance throws UnsupportedOperationException naming the method. It is a placeholder handler meant only for proxies that should never be invoked directly.","triggerScenarios":"Calling Proxy.getProxy(...).newInstance() (the no-arg overload) and then invoking any method on the returned proxy object.","commonSituations":"Creating a proxy but forgetting to supply a real InvocationHandler; unit-test stubs that instantiate a proxy and then call it; a code path that falls back to newInstance() instead of newInstance(handler).","solutions":["Use newInstance(handler) with a real InvocationHandler instead of the no-arg newInstance().","If using Dubbo's InvokerInvocationHandler, construct and pass it explicitly.","Treat any UnsupportedOperationException 'unimplemented' as a misconfiguration of the proxy factory, not a runtime bug to catch."],"exampleFix":"// before\nObject proxy = dubboProxy.newInstance();\n((MyService) proxy).hello(); // throws\n\n// after\nInvocationHandler h = new MyInvocationHandler(target);\nObject proxy = dubboProxy.newInstance(h);\n((MyService) proxy).hello(); // dispatched to h","handlingStrategy":"validation","validationCode":"// do not call the no-arg newInstance(); always supply a handler\nInvocationHandler handler = new MyInvocationHandler(target);\nObject proxy = dubboProxy.newInstance(handler);","typeGuard":null,"tryCatchPattern":"try {\n    ((MyService) proxy).hello();\n} catch (UnsupportedOperationException e) {\n    // proxy was created with the default THROW_UNSUPPORTED_INVOKER; supply a real handler\n}","preventionTips":["Always use Proxy.newInstance(handler) with a concrete InvocationHandler.","Treat 'unimplemented' as a wiring/config bug, not an expected runtime path.","Audit code that calls the no-arg newInstance()."],"tags":["bytecode","proxy","configuration"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}