[cdi-dev] [JBoss JIRA] (CDI-731) Default methods in Annotated hierarchy should use privileged blocs

Martin Kouba (JIRA) issues at jboss.org
Wed Jun 27 09:27:00 EDT 2018

    [ https://issues.jboss.org/browse/CDI-731?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13597752#comment-13597752 ] 

Martin Kouba commented on CDI-731:

The problem is that our tests use mock implementations of these interfaces. So for example to test the {{AnnotatedMethod}} default method we do call {{java.lang.Class.getMethod()}} which is a subject to access control: https://github.com/antoinesd/cdi-spec/blob/master/api/src/test/java/org/jboss/cdi/api/test/annotated/AnnotatedMethodTest.java#L30

That's why we see "access denied ("java.lang.reflect.ReflectPermission" "suppressAccessChecks")" in the stack.

> Default methods in Annotated hierarchy should use privileged blocs
> ------------------------------------------------------------------
>                 Key: CDI-731
>                 URL: https://issues.jboss.org/browse/CDI-731
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Javadoc and API
>    Affects Versions: 2.0 .Final
>            Reporter: Antoine Sabot-Durand
>            Assignee: Antoine Sabot-Durand
>             Fix For: 2.0.SP1
> To deal with repearting annotatiosn (see CDI-471), CDI 2.0 introduced default method {{getAnnotations}}, in the following interfaces:
> * {{AnnotatedConstructor}}
> * {{AnnotatedField}}
> * {{AnnotatedMethod}}
> * {{AnnotatedParameter}}
> * {{AnnotatedType}}
> These methods make use of reflection and thus should use privileged blocs when used with a security manager

This message was sent by Atlassian JIRA

More information about the cdi-dev mailing list