{"record":{"id":"45d37c4aae6ed9f2","repo":"alibaba/COLA","slug":"extension-interface-name-illegal","errorCode":"EXTENSION_INTERFACE_NAME_ILLEGAL","errorMessage":"Your name of ExtensionPoint for ${targetClz} is not valid, must be end of ExtPt","messagePattern":"Your name of ExtensionPoint for (.+?) is not valid, must be end of ExtPt","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":105,"sourceCode":"\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":87,"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#L87-L109","documentation":"Thrown by ExtensionRegister.calculateExtensionPoint when the @Extension class implements interfaces, but none of their simple names contain 'ExtPt' (EXTENSION_EXTPT_NAMING). The registry identifies extension points by this naming convention. ExtensionException carries code EXTENSION_INTERFACE_NAME_ILLEGAL.","triggerScenarios":"Registering an @Extension class whose implemented interfaces exist but none end with/contain 'ExtPt' in the simple name.","commonSituations":"Naming the extension point interface 'PayExtension' or 'IPay' instead of 'PayExtPt'; implementing only generic interfaces like Serializable; team convention drift after renaming.","solutions":["Rename the extension point interface so its simple name contains 'ExtPt' (e.g. PayExtPt)","Implement the correct ExtPt interface instead of a plain interface","Confirm EXTENSION_EXTPT_NAMING constant matches your project's naming convention"],"exampleFix":"// before\npublic interface PayExtension { void pay(); }\npublic class AlipayExt implements PayExtension {...}\n// after\npublic interface PayExtPt { void pay(); }\npublic class AlipayExt implements PayExtPt {...}","handlingStrategy":"validation","validationCode":"boolean hasExtPt = Arrays.stream(ClassUtils.getAllInterfacesForClass(clazz))\n    .anyMatch(i -> i.getSimpleName().contains(\"ExtPt\"));\nif (!hasExtPt) throw new IllegalStateException(clazz + \" must implement a *ExtPt interface\");","typeGuard":"boolean hasValidExtPt(Class<?> clz) {\n    Class<?>[] ifaces = ClassUtils.getAllInterfacesForClass(clz);\n    return ifaces != null && Arrays.stream(ifaces)\n        .anyMatch(i -> i.getSimpleName().contains(\"ExtPt\"));\n}","tryCatchPattern":"try {\n    register(extension);\n} catch (ExtensionException e) {\n    if (\"EXTENSION_INTERFACE_NAME_ILLEGAL\".equals(e.getErrorCode())) {\n        log.error(\"Rename extension point interface of {} to end with ExtPt\", extension.getClass(), e);\n    }\n}","preventionTips":["Adopt and enforce the *ExtPt naming convention in code review","Add a unit test asserting every @Extension class implements an interface containing 'ExtPt'","Avoid implementing only marker/generic interfaces on extension classes"],"tags":["java","extension","naming-convention"],"backgroundTag":"invalid-identifier-format","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"}