{"record":{"id":"ab1e3d3d070ddd8a","repo":"Tencent/QMUI_Android","slug":"s-did-not-call-through-to-super-shouldpreventswip","errorCode":null,"errorMessage":"%s did not call through to super.shouldPreventSwipeBack()","messagePattern":"(.+?) did not call through to super\\.shouldPreventSwipeBack\\(\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"arch/src/main/java/com/qmuiteam/qmui/arch/QMUIFragment.java","lineNumber":591,"sourceCode":"            mCacheRootView = rootView;\n        } else {\n            if (rootView.getParent() != null) {\n                ((ViewGroup) rootView.getParent()).removeView(rootView);\n            }\n        }\n        SwipeBackLayout swipeBackLayout = SwipeBackLayout.wrap(rootView,\n                dragViewMoveAction(),\n                new SwipeBackLayout.Callback() {\n                    @Override\n                    public int getDragDirection(SwipeBackLayout swipeBackLayout, SwipeBackLayout.ViewMoveAction viewMoveAction, float downX, float downY, float dx, float dy, float touchSlop) {\n\n                        mCalled = false;\n                        if(mDisableSwipeBackByMutiStarted){\n                            return DRAG_DIRECTION_NONE;\n                        }\n                        boolean canHandle = canHandleSwipeBack();\n                        if (canHandle && !mCalled) {\n                            throw new RuntimeException(getClass().getSimpleName() + \" did not call through to super.shouldPreventSwipeBack()\");\n                        }\n\n                        if(!canHandle){\n                            return DRAG_DIRECTION_NONE;\n                        }\n                        return QMUIFragment.this.getDragDirection(\n                                swipeBackLayout, viewMoveAction, downX, downY, dx, dy, touchSlop);\n                    }\n\n                    @Override\n                    public void reportFrequentlyRequestLayout(int count, long duration) {\n                        QMUIFragment.this.reportFrequentlyRequestLayout(count, duration);\n                    }\n                });\n        initSwipeBackLayout(swipeBackLayout);\n        if(getParentFragment() != null){\n            mCacheSwipeBackView = swipeBackLayout;\n        }","sourceCodeStart":573,"sourceCodeEnd":609,"githubUrl":"https://github.com/Tencent/QMUI_Android/blob/026e7d486677d6593a96689cd590ec3561176717/arch/src/main/java/com/qmuiteam/qmui/arch/QMUIFragment.java#L573-L609","documentation":"QMUIFragment's swipe-back mechanism calls canHandleSwipeBack(), which sets an internal mCalled flag when the base shouldPreventSwipeBack() is invoked. If a subclass overrides shouldPreventSwipeBack() without calling super, mCalled stays false while canHandle is true, so the library throws to enforce the override contract.","triggerScenarios":"Overriding shouldPreventSwipeBack() in a subclass without calling super.shouldPreventSwipeBack(), then attempting a swipe-back gesture on a fragment where canHandleSwipeBack() is true.","commonSituations":"Customizing swipe-back direction logic and forgetting the super call; copy-pasted overrides from older library versions that did not require super.","solutions":["Call super.shouldPreventSwipeBack() first in the override and use its result","Return DRAG_DIRECTION_NONE / base value combined with your custom logic","Remove the override entirely if default behavior is acceptable"],"exampleFix":"// before\n@Override\nprotected int shouldPreventSwipeBack() {\n    return mCustomCondition ? DRAG_DIRECTION_NONE : DRAG_DIRECTION_LEFT;\n}\n// after\n@Override\nprotected int shouldPreventSwipeBack() {\n    int base = super.shouldPreventSwipeBack();\n    return mCustomCondition ? DRAG_DIRECTION_NONE : base;\n}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call super.shouldPreventSwipeBack() when overriding","Search codebase for overrides lacking super calls after upgrades","Read override-contract docs in QMUIFragment javadoc"],"tags":["android","override-contract","swipeback"],"backgroundTag":"super-not-called","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"}