apache/maven · error · DIException

Not allowed to call method {}

Error message

Not allowed to call method {}

What it means

Error "Not allowed to call method {}" thrown in apache/maven.

Source

Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:321

                args -> {
                    try {
                        Object instance;
                        Object[] params;
                        if (Modifier.isStatic(method.getModifiers())) {
                            instance = null;
                            params = args;
                        } else {
                            instance = args[0];
                            params = Arrays.copyOfRange(args, 1, args.length);
                        }
                        T result = (T) method.invoke(instance, params);
                        if (result == null) {
                            throw new NullPointerException(
                                    "@Provides method must return non-null result, method " + method);
                        }
                        return result;
                    } catch (IllegalAccessException e) {
                        throw new DIException("Not allowed to call method " + method, e);
                    } catch (InvocationTargetException e) {
                        throw new DIException("Failed to call method " + method, e.getCause());
                    }
                },
                toDependencies(method.getDeclaringClass(), method));

        Priority priority = method.getAnnotation(Priority.class);
        if (priority != null) {
            binding = binding.prioritize(priority.value());
        }

        return binding;
    }

    public static <T> Binding<T> bindingFromConstructor(Key<T> key, Constructor<T> constructor) {
        constructor.setAccessible(true);

        Dependency<?>[] dependencies = toDependencies(key.getType(), constructor);

View on GitHub (pinned to e4093d4e12)

When it happens

Trigger: Thrown at impl/maven-di/src/main/java/org/apache/maven/di/impl/ReflectionUtils.java:321 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/maven@e4093d4e12 (2026-08-21). Data as JSON: /api/errors/fa8835a4b604dcbe. Report an issue: GitHub.