{"record":{"id":"99f6e2b54bfb96e3","repo":"apache/dubbo","slug":"class-is-not-a-interface","errorCode":null,"errorMessage":"Class {} is not a interface.","messagePattern":"Class (.+?) is not a interface\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Mixin.java","lineNumber":226,"sourceCode":"    private static int findMethod(Class<?>[] dcs, String desc) {\n        Class<?> cl;\n        Method[] methods;\n        for (int i = 0; i < dcs.length; i++) {\n            cl = dcs[i];\n            methods = cl.getMethods();\n            for (Method method : methods) {\n                if (desc.equals(ReflectUtils.getDesc(method))) {\n                    return i;\n                }\n            }\n        }\n        return -1;\n    }\n\n    private static void assertInterfaceArray(Class<?>[] ics) {\n        for (int i = 0; i < ics.length; i++) {\n            if (!ics[i].isInterface()) {\n                throw new RuntimeException(\"Class \" + ics[i].getName() + \" is not a interface.\");\n            }\n        }\n    }\n\n    /**\n     * new Mixin instance.\n     *\n     * @param ds delegates instance.\n     * @return instance.\n     */\n    public abstract Object newInstance(Object[] ds);\n\n    public static interface MixinAware {\n        void setMixinInstance(Object instance);\n    }\n}\n","sourceCodeStart":208,"sourceCodeEnd":243,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/common/bytecode/Mixin.java#L208-L243","documentation":"Thrown by Mixin.assertInterfaceArray at the start of mixin(). It verifies every element of the ics array is actually an interface; passing a concrete or abstract class is a programming error because Dubbo generates an implementor, not a subclass. The message names the offending class.","triggerScenarios":"Mixin.mixin(new Class[]{ SomeClass.class }, dc) where SomeClass is not declared with the interface keyword.","commonSituations":"Passing an implementation class instead of its interface by mistake; passing a class that was refactored from interface to abstract class; copy-paste of the wrong Class reference.","solutions":["Pass the interface type, not a concrete/abstract class, in the ics array.","If you intended to proxy a class rather than implement an interface, use a different mechanism (Proxy only handles interfaces too).","Add a compile-time or pre-call check ic.isInterface() for each element."],"exampleFix":"// before\nMixin.mixin(new Class[]{ ServiceImpl.class }, dc); // ServiceImpl is a class\n\n// after\nMixin.mixin(new Class[]{ Service.class }, dc); // Service is the interface","handlingStrategy":"validation","validationCode":"for (Class<?> ic : ics) {\n    if (!ic.isInterface()) {\n        throw new IllegalArgumentException(ic.getName() + \" is not an interface\");\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass interface types, not classes, to Mixin.mixin.","Add a unit test that asserts each element of ics is an interface."],"tags":["bytecode","mixin","interface","validation"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}