{"record":{"id":"574f8b70d6b16051","repo":"Blankj/AndroidUtilCode","slug":"these-buses-is-not-right-wrongbus-n-u-can","errorCode":null,"errorMessage":"These buses is not right: \" + wrongBus + \"\\n u can check it in file: \" + jsonFile.toString()","messagePattern":"These buses is not right: \" \\+ wrongBus \\+ \"\\\\n u can check it in file: \" \\+ jsonFile\\.toString\\(\\)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"plugin/bus-gradle-plugin/src/main/java/com/blankj/bus/BusPlugin.groovy","lineNumber":122,"sourceCode":"                    }\n                    if (!rightInfoString.isEmpty()) {\n                        rightBus.put(tag, rightInfoString)\n                    }\n                    if (!wrongInfoString.isEmpty()) {\n                        wrongBus.put(tag, wrongInfoString)\n                    }\n                }\n                Map busDetails = [:]\n                busDetails.put(\"BusUtilsClass\", ext.busUtilsClass)\n                busDetails.put(\"rightBus\", rightBus)\n                busDetails.put(\"wrongBus\", wrongBus)\n                String busJson = JsonUtils.getFormatJson(busDetails)\n                log(jsonFile.toString() + \": \" + busJson)\n                FileUtils.write(jsonFile, busJson)\n\n                if (wrongBus.size() > 0) {\n                    if (ext.abortOnError) {\n                        throw new Exception(\"These buses is not right: \" + wrongBus +\n                                \"\\n u can check it in file: \" + jsonFile.toString())\n                    }\n                }\n\n                BusInject.start(busMap, busUtilsTransformFile, ext.busUtilsClass)\n            }\n        } else {\n            throw new Exception(\"No BusUtils of ${ext.busUtilsClass} in $mProject.\")\n        }\n    }\n}","sourceCodeStart":104,"sourceCodeEnd":133,"githubUrl":"https://github.com/Blankj/AndroidUtilCode/blob/7b4caf9e5440046b3fefb63b6b6e2ead7ebaf809/plugin/bus-gradle-plugin/src/main/java/com/blankj/bus/BusPlugin.groovy#L104-L133","documentation":"BusClassVisitor records isParamSizeNoMoreThanOne for each @BusUtils.Bus method and flips it false once the parameter count exceeds 1. After scanning, methods with > 1 parameter are collected into wrongBus. BusUtils only supports zero- or one-parameter subscribers (post(tag) or post(tag, arg)). If wrongBus is non-empty and ext.abortOnError is true (default), it throws Exception listing the offenders and pointing at __bus__.json.","triggerScenarios":"A method annotated @BusUtils.Bus is declared with two or more parameters, e.g. @BusUtils.Bus(tag = \"x\") void fun(String a, int b); BusUtils has no way to deliver multiple args by tag.","commonSituations":"Refactoring a subscriber to take an extra context/flag parameter; copy-pasting from an EventBus-style signature; misunderstanding that BusUtils passes at most a single optional arg keyed by tag.","solutions":["Reduce the annotated method to zero or one parameter.","If multiple values are needed, wrap them in one parameter type and post that object via BusUtils.post(tag, wrapper).","Temporarily set abortOnError = false to allow the build (the offending bus is simply not registered/injected; use only for diagnostics)."],"exampleFix":"// before - subscriber has 2 params -> \"These buses is not right\"\n@BusUtils.Bus(tag = \"update_profile\")\npublic void onUpdate(String name, int age) { /* ... */ }\n\n// after - at most one param; wrap multiple values in a bean\npublic class ProfileUpdate {\n    public final String name;\n    public final int age;\n    public ProfileUpdate(String name, int age) { this.name = name; this.age = age; }\n}\n\n@BusUtils.Bus(tag = \"update_profile\")\npublic void onUpdate(ProfileUpdate update) { /* ... */ }\n// post with: BusUtils.post(\"update_profile\", new ProfileUpdate(\"neo\", 42));","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Every @BusUtils.Bus method must take 0 or 1 parameter.","Bundle multiple values into a single bean object posted as the one arg.","Inspect the generated __bus__.json after each build to catch wrongBus entries early."],"tags":["gradle-plugin","bus","build","asm"],"backgroundTag":null,"analyzedSha":"7b4caf9e5440046b3fefb63b6b6e2ead7ebaf809","analyzedAt":"2026-08-14T02:26:54.956Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}