{"record":{"id":"1910c932254fd703","repo":"apache/maven","slug":"the-use-of-session-scoped-proxies-require-a-org-ap","errorCode":null,"errorMessage":"The use of session scoped proxies require a org.apache.maven.api.di.Typed, org.eclipse.sisu.Typed or javax.enterprise.inject.Typed annotation","messagePattern":"The use of session scoped proxies require a org\\.apache\\.maven\\.api\\.di\\.Typed, org\\.eclipse\\.sisu\\.Typed or javax\\.enterprise\\.inject\\.Typed annotation","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"impl/maven-impl/src/main/java/org/apache/maven/impl/di/SessionScope.java","lineNumber":146,"sourceCode":"                            (Class<?>[]) annotationType.getMethod(\"value\").invoke(a);\n                    if (value.length == 0) {\n                        // Only direct interfaces implemented by the class\n                        value = superType.getInterfaces();\n                    }\n                    List<Class<?>> nonInterfaces =\n                            Stream.of(value).filter(c -> !c.isInterface()).toList();\n                    if (!nonInterfaces.isEmpty()) {\n                        throw new IllegalArgumentException(\n                                \"The Typed annotation must contain only interfaces but the following types are not: \"\n                                        + nonInterfaces);\n                    }\n                    return value;\n                } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {\n                    throw new IllegalStateException(e);\n                }\n            }\n        }\n        throw new IllegalArgumentException(\n                \"The use of session scoped proxies require a org.apache.maven.api.di.Typed, org.eclipse.sisu.Typed or javax.enterprise.inject.Typed annotation\");\n    }\n\n    protected boolean isTypeAnnotation(Class<? extends Annotation> annotationType) {\n        return \"org.apache.maven.api.di.Typed\".equals(annotationType.getName());\n    }\n\n    /**\n     * A provider wrapping an existing provider with a cache\n     * @param <T> the provided type\n     */\n    protected static class CachingProvider<T> implements Supplier<T> {\n        private final Supplier<T> provider;\n        private volatile T value;\n\n        CachingProvider(Supplier<T> provider) {\n            this.provider = provider;\n        }","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/apache/maven/blob/e4093d4e120eac99d6bdce5ba67cace2f3085c97/impl/maven-impl/src/main/java/org/apache/maven/impl/di/SessionScope.java#L128-L164","documentation":"SessionScope can only create proxies for session-scoped classes when it can determine the interfaces to proxy, which requires a recognized @Typed annotation: org.apache.maven.api.di.Typed, org.eclipse.sisu.Typed, or javax.enterprise.inject.Typed. If none is present on a class being proxied, IllegalArgumentException is thrown stating the annotation is required.","triggerScenarios":"Marking a class @SessionScoped (or otherwise proxied by SessionScope) without any @Typed annotation; using a custom Typed annotation whose FQCN is not one of the three recognized names (isTypeAnnotation() matches by name).","commonSituations":"New session-scoped components written without the annotation; migrating code from javax to jakarta-style annotations and picking an unrecognized Typed; renaming packages so the annotation FQCN no longer matches.","solutions":["Add @Typed(...) to the session-scoped class, importing org.apache.maven.api.di.Typed (or org.eclipse.sisu.Typed)","List the service interfaces in the value: @Typed(MyService.class)","Verify the annotation is one of the three supported FQCNs — a same-shaped custom annotation is ignored"],"exampleFix":"// before\n@SessionScoped\npublic class MyServiceImpl implements MyService { ... }\n\n// after\nimport org.apache.maven.api.di.Typed;\n\n@SessionScoped\n@Typed(MyService.class)\npublic class MyServiceImpl implements MyService { ... }","handlingStrategy":"validation","validationCode":"// verify the annotation is one Maven recognizes before the proxy is built\nstatic boolean hasRecognizedTyped(Class<?> c) {\n    for (Annotation a : c.getAnnotations()) {\n        String n = a.annotationType().getName();\n        if (\"org.apache.maven.api.di.Typed\".equals(n)\n                || \"org.eclipse.sisu.Typed\".equals(n)\n                || \"javax.enterprise.inject.Typed\".equals(n)) return true;\n    }\n    return false;\n}\nif (!hasRecognizedTyped(MyServiceImpl.class)) throw new IllegalStateException(\"Missing @Typed on session-scoped class\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Annotate every session-scoped class with @Typed, importing org.apache.maven.api.di.Typed","Do not invent a custom Typed annotation — matching is by exact FQCN","Check imports after package refactors or javax/jakarta migrations"],"tags":["maven","di","annotation","proxy","scope"],"backgroundTag":"missing-typed-annotation","analyzedSha":"e4093d4e120eac99d6bdce5ba67cace2f3085c97","analyzedAt":"2026-08-21T22:58:24.034Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}