Skip to content

Commit

Permalink
HV-1439 Disable AnnotationProxy equals optimization if the security m…
Browse files Browse the repository at this point in the history
…anager is enabled

Apparently, the security check for getInvocationHandler() was not
correctly implemented in JDK 8 < 131.
  • Loading branch information
gsmet committed Aug 3, 2017
1 parent 6be0928 commit 6caa16d
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -183,7 +183,9 @@ else if ( m.getDefaultValue() != null ) {
}

private Map<String, Object> getAnnotationValues(Annotation annotation) {
if ( Proxy.isProxyClass( annotation.getClass() ) ) {
// We only enable this optimization if the security manager is not enabled. Otherwise,
// we would have to add every package containing constraints to the security policy.
if ( Proxy.isProxyClass( annotation.getClass() ) && System.getSecurityManager() == null ) {
InvocationHandler invocationHandler = Proxy.getInvocationHandler( annotation );
if ( invocationHandler instanceof AnnotationProxy ) {
return ( (AnnotationProxy) invocationHandler ).values;
Expand Down

0 comments on commit 6caa16d

Please sign in to comment.