{"record":{"id":"a82578faea31cb22","repo":"apache/maven","slug":"not-allowed-to-call-injectable-method","errorCode":null,"errorMessage":"Not allowed to call injectable method {}","messagePattern":"Not allowed to call injectable method (.+?)","errorType":"exception","errorClass":"DIException","httpStatus":null,"severity":"error","filePath":"impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java","lineNumber":260,"sourceCode":"            }\n        };\n    }\n\n    public static <T> BindingInitializer<T> methodInjector(Key<T> container, Method method) {\n        method.setAccessible(true);\n        Dependency<?>[] dependencies = toDependencies(container.getType(), method);\n        return new BindingInitializer<T>(new HashSet<>(Arrays.asList(dependencies))) {\n            @Override\n            public Consumer<T> compile(Function<Dependency<?>, Supplier<?>> compiler) {\n                return instance -> {\n                    Object[] args = getDependencies().stream()\n                            .map(compiler)\n                            .map(Supplier::get)\n                            .toArray();\n                    try {\n                        method.invoke(instance, args);\n                    } catch (IllegalAccessException e) {\n                        throw new DIException(\"Not allowed to call injectable method \" + method, e);\n                    } catch (InvocationTargetException e) {\n                        throw new DIException(\"Failed to call injectable method \" + method, e.getCause());\n                    }\n                };\n            }\n        };\n    }\n\n    public static Dependency<?>[] toDependencies(@Nullable Type container, Executable executable) {\n        Dependency<?>[] keys = toArgDependencies(container, executable);\n        if (executable instanceof Constructor || Modifier.isStatic(executable.getModifiers())) {\n            return keys;\n        } else {\n            Dependency<?>[] nkeys = new Dependency[keys.length + 1];\n            nkeys[0] = new Dependency<>(Key.ofType(container), false);\n            System.arraycopy(keys, 0, nkeys, 1, keys.length);\n            return nkeys;\n        }","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java#L242-L278","documentation":"Error \"Not allowed to call injectable method {}\" thrown in apache/maven.","triggerScenarios":"Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:260 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}