{"record":{"id":"c3a500bf768d91fc","repo":"Tencent/QMUI_Android","slug":"fragmentscheme-activities-can-not-be-empty","errorCode":null,"errorMessage":"FragmentScheme#activities can not be empty.","messagePattern":"FragmentScheme#activities can not be empty\\.","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"arch-compiler/src/main/java/com/qmuiteam/qmui/arch/SchemeProcessor.java","lineNumber":393,"sourceCode":"        }\n\n        return CodeBlock.of(\"$T.class\", typeMirror);\n    }\n\n    private CodeBlock generateFragmentHostActivityList(FragmentScheme fragmentScheme){\n        CodeBlock.Builder builder = CodeBlock.builder();\n        TypeMirror[] activities = null;\n        try {\n            fragmentScheme.activities();\n        } catch (MirroredTypesException mte) {\n            List<? extends TypeMirror> containerMirrors = mte.getTypeMirrors();\n            activities = new TypeMirror[containerMirrors.size()];\n            for (int i = 0; i < activities.length; i++) {\n                activities[i] = containerMirrors.get(i);\n            }\n        }\n        if(activities == null || activities.length == 0){\n            throw new IllegalStateException(\"FragmentScheme#activities can not be empty.\");\n        }\n        builder.add(\"new $T[]{\", OriginClassName);\n        for(int i=0; i < activities.length; i++){\n            TypeMirror item = activities[i];\n            if(!isSubtypeOfType(item, QMUI_FRAGMENT_ACTIVITY_TYPE)){\n                throw new IllegalStateException(\"FragmentScheme#activities must be QMUIFragmentActivity.\");\n            }\n            if(i > 0){\n                builder.add(\",\");\n            }\n            builder.add(\"$T.class\", ClassName.get(item));\n        }\n        builder.add(\"}\");\n        return builder.build();\n    }\n\n    @Override\n    public Set<String> getSupportedAnnotationTypes() {","sourceCodeStart":375,"sourceCodeEnd":411,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/arch-compiler/src/main/java/com/qmuiteam/qmui/arch/SchemeProcessor.java#L375-L411","documentation":"SchemeProcessor.generateFragmentHostActivityList requires every FragmentScheme to declare at least one host activity via the activities element. When the array is null or empty the processor throws this IllegalStateException, aborting annotation processing.","triggerScenarios":"Using @FragmentScheme (or equivalent) without setting activities, or explicitly passing an empty list/array of activity classes.","commonSituations":"Newly added scheme annotation copied without filling activities; conditional code accidentally removed the activities value; misunderstanding that the fragment must be hosted by a QMUIFragmentActivity.","solutions":["Set activities = [YourActivity::class] (a QMUIFragmentActivity subclass) on the FragmentScheme annotation.","Ensure the fragment is intended to be hosted inside a QMUIFragmentActivity; otherwise use a different scheme type.","Re-run the build after filling the attribute."],"exampleFix":"// before\n@FragmentScheme(name = \"page\")\nclass DetailFragment : QMUIFragment() { ... }\n\n// after\n@FragmentScheme(name = \"page\", activities = [MainActivity::class])\nclass DetailFragment : QMUIFragment() { ... }","handlingStrategy":"validation","validationCode":"// annotation-level check before compiling:\n// every @FragmentScheme must declare non-empty activities\nfun checkActivities(activities: List<Class<*>>) =\n    check(activities.isNotEmpty()) { \"FragmentScheme#activities can not be empty.\" }","typeGuard":"fun hasHostActivities(activities: Array<Class<*>>?): Boolean =\n    !activities.isNullOrEmpty()","tryCatchPattern":null,"preventionTips":["Always fill the activities attribute when adding a new @FragmentScheme","Use a code-review checklist item for scheme annotations","Keep CI compiling annotated modules so the processor fails fast"],"tags":["annotation-processor","compile-time","scheme","missing-attribute"],"backgroundTag":"missing-required-argument","analyzedSha":"026e7d486677d6593a96689cd590ec3561176717","analyzedAt":"2026-09-06T13:32:24.816Z","contentChangedAt":"2026-09-06T13:32:24.816Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}