{"record":{"id":"e74c4ad0f1858e11","repo":"pinpoint-apm/pinpoint","slug":"non-private-utilmethod-unsupported-method-metho","errorCode":null,"errorMessage":"non private UtilMethod unsupported. method=${methodLongName}","messagePattern":"non private UtilMethod unsupported\\. method=(.+?)","errorType":"exception","errorClass":"InstrumentException","httpStatus":null,"severity":"error","filePath":"agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMAspectWeaver.java","lineNumber":97,"sourceCode":"            if (methodNode.hasAnnotation(PointCut.class)) {\n                methodNodes.pointCuts.add(methodNode);\n                continue;\n            }\n            if (methodNode.hasAnnotation(JointPoint.class)) {\n                methodNodes.jointPoints.add(methodNode);\n                continue;\n            }\n\n            methodNodes.utils.add(methodNode);\n        }\n\n        return methodNodes;\n    }\n\n    private void copyUtilMethods(final MethodNodes methodNodes, final ASMClassNodeAdapter classNode) throws InstrumentException {\n        for (ASMMethodNodeAdapter methodNode : methodNodes.utils) {\n            if (!methodNode.isPrivate()) {\n                throw new InstrumentException(\"non private UtilMethod unsupported. method=\" + methodNode.getLongName());\n            }\n\n            classNode.copyMethod(methodNode);\n        }\n    }\n\n    private void copyPointCutMethods(final MethodNodes methodNodes, final ASMClassNodeAdapter classNode) throws InstrumentException {\n        final ASMMethodInsnNodeRemapper.Builder remapBuilder = new ASMMethodInsnNodeRemapper.Builder();\n        for (ASMMethodNodeAdapter joinPointMethodNode : methodNodes.jointPoints) {\n            remapBuilder.addFilter(null, joinPointMethodNode.getName(), joinPointMethodNode.getDesc());\n        }\n\n        for (ASMMethodNodeAdapter pointCutMethodNode : methodNodes.pointCuts) {\n            final ASMMethodNodeAdapter sourceMethodNode = classNode.getDeclaredMethod(pointCutMethodNode.getName(), pointCutMethodNode.getDesc());\n            if (sourceMethodNode == null) {\n                throw new InstrumentException(\"not found method. \" + classNode.getInternalName() + \".\" + pointCutMethodNode.getName());\n            }\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/instrument/ASMAspectWeaver.java#L79-L115","documentation":"copyUtilMethods() copies methods annotated @ProfilerCallUtility from the advice class into the source class, but only private utility methods are supported. A non-private (public/protected/package-private) utility method cannot be safely copied, so InstrumentException is thrown naming the method.","triggerScenarios":"An @Aspect advice class declares a utility method annotated as a util method with an access modifier other than private, and weaving() encounters it during copyUtilMethods.","commonSituations":"Plugin authors writing advice utility methods and forgetting to make them private after refactoring visibility, or an upgrade of the weaver adding stricter access checks.","solutions":["Change the utility method to private","Remove the util-method annotation if the method shouldn't be copied","Rename it so it doesn't collide with source class methods and keep it private","Split non-private logic into the pointcut methods instead"],"exampleFix":"// before\npublic String helper() { return \"x\"; }\n// after\nprivate String helper() { return \"x\"; }","handlingStrategy":"validation","validationCode":"for (ASMMethodNodeAdapter m : utilMethods) { if (!m.isPrivate()) { throw new IllegalArgumentException(\"util method must be private: \" + m.getLongName()); } }","typeGuard":null,"tryCatchPattern":"try { weaver.weaving(src, adv); } catch (InstrumentException e) { if (e.getMessage().startsWith(\"non private UtilMethod\")) { logger.error(\"make util method private: {}\", e.getMessage()); } }","preventionTips":["Declare all @ProfilerCallUtility methods private","Review visibility after refactors","Run plugin build-time checks against the weaver rules"],"tags":["java","bytecode","aspect","access-modifier"],"backgroundTag":"unsupported-operation","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}