{"record":{"id":"b8cd63ea3a4ab90d","repo":"alibaba/COLA","slug":"extension-illegal","errorCode":"EXTENSION_ILLEGAL","errorMessage":"Please assign a extension point interface for ${targetClz}","messagePattern":"Please assign a extension point interface for (.+?)","errorType":"error_code","errorClass":"ExtensionException","httpStatus":null,"severity":"error","filePath":"cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionRegister.java","lineNumber":95,"sourceCode":"                    ExtensionCoordinate extensionCoordinate = new ExtensionCoordinate(calculateExtensionPoint(extensionClz), bizScenario.getUniqueIdentity());\n                    ExtensionPointI preVal = extensionRepository.getExtensionRepo().put(extensionCoordinate, extensionObject);\n                    if (preVal != null) {\n                        String errMessage = \"Duplicate registration is not allowed for :\" + extensionCoordinate;\n                        throw new ExtensionException(EXTENSION_DEFINE_DUPLICATE, errMessage);\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * @param targetClz\n     * @return\n     */\n    private String calculateExtensionPoint(Class<?> targetClz) {\n        Class<?>[] interfaces = ClassUtils.getAllInterfacesForClass(targetClz);\n        if (interfaces == null || interfaces.length == 0) {\n            throw new ExtensionException(EXTENSION_ILLEGAL, \"Please assign a extension point interface for \" + targetClz);\n        }\n        for (Class intf : interfaces) {\n            String extensionPoint = intf.getSimpleName();\n            if (extensionPoint.contains(EXTENSION_EXTPT_NAMING)) {\n                return intf.getName();\n            }\n        }\n        String errMessage = \"Your name of ExtensionPoint for \" + targetClz +\n                \" is not valid, must be end of \" + EXTENSION_EXTPT_NAMING;\n        throw new ExtensionException(EXTENSION_INTERFACE_NAME_ILLEGAL, errMessage);\n    }\n\n}\n","sourceCodeStart":77,"sourceCodeEnd":109,"githubUrl":"https://github.com/alibaba/COLA/blob/352e1a867538d9cd40e1b11e4028fa652fc97557/cola-components/cola-component-extension-starter/src/main/java/com/alibaba/cola/extension/register/ExtensionRegister.java#L77-L109","documentation":"Thrown by ExtensionRegister.calculateExtensionPoint when an @Extension-annotated class implements no interfaces at all. The extension mechanism dispatches via an extension point interface, so a class with no interface cannot be registered. ExtensionException carries code EXTENSION_ILLEGAL.","triggerScenarios":"Registering an @Extension class (via extensionCoordinate registration) whose class implements zero interfaces, so ClassUtils.getAllInterfacesForClass returns null or empty.","commonSituations":"Annotating a concrete helper class with @Extension by mistake; refactoring removed the implemented interface; copying an @Extension annotation onto a non-extension class.","solutions":["Make the @Extension class implement an extension point interface whose simple name contains 'ExtPt' (e.g. SomeBizExtPt)","Remove the @Extension annotation if the class is not meant to be an extension","Check for refactoring that dropped the 'implements' clause and restore it"],"exampleFix":"// before\n@Extension(bizId = \"pay\")\npublic class AlipayExt {\n    public void pay() {...}\n}\n// after\n@Extension(bizId = \"pay\")\npublic class AlipayExt implements PayExtPt {\n    public void pay() {...}\n}","handlingStrategy":"validation","validationCode":"if (ClassUtils.getAllInterfacesForClass(clazz) == null || ClassUtils.getAllInterfacesForClass(clazz).length == 0) {\n    throw new IllegalStateException(clazz + \" must implement an extension point interface\");\n}","typeGuard":"boolean isRegisterable(Class<?> clz) {\n    Class<?>[] ifaces = ClassUtils.getAllInterfacesForClass(clz);\n    return ifaces != null && ifaces.length > 0;\n}","tryCatchPattern":"try {\n    register(extension);\n} catch (ExtensionException e) {\n    if (\"EXTENSION_ILLEGAL\".equals(e.getErrorCode())) {\n        log.error(\"{} is missing an extension point interface\", extension.getClass(), e);\n    }\n}","preventionTips":["Always pair @Extension with an ExtPt interface","Add an architecture/unit test scanning @Extension classes for implemented interfaces","Review 'implements' clauses during refactors of extension classes"],"tags":["java","extension","registration"],"backgroundTag":"missing-required-interface","analyzedSha":"352e1a867538d9cd40e1b11e4028fa652fc97557","analyzedAt":"2026-09-08T00:46:23.972Z","contentChangedAt":"2026-09-08T00:46:23.972Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}