Skip to content

Commit

Permalink
HV-1882 Fix a few previously undetected uses of methods deprecated in…
Browse files Browse the repository at this point in the history
… JDK 17

Not sure why this wasn't detected before; probably because we were
running compiling tests to Java 8 bytecode.
  • Loading branch information
yrodiere authored and gsmet committed Feb 24, 2022
1 parent 24f9905 commit bf9f51e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ private void runWithoutElLibs(Class<?> delegateType, String packageMissing) thro
* <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
* privileged actions within HV's protection domain.
*/
@IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in JDK17")
private <T> T run(PrivilegedAction<T> action) {
return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import javax.validation.ValidationException;

import org.hibernate.validator.internal.IgnoreForbiddenApisErrors;
import org.hibernate.validator.internal.util.privilegedactions.LoadClass;
import org.hibernate.validator.testutil.TestForIssue;
import org.jboss.shrinkwrap.api.ShrinkWrap;
Expand Down Expand Up @@ -61,6 +62,7 @@ private static boolean isClassPresent(String className, ClassLoader classLoader,
* <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary
* privileged actions within HV's protection domain.
*/
@IgnoreForbiddenApisErrors(reason = "SecurityManager is deprecated in JDK17")
private static <T> T run(PrivilegedAction<T> action) {
return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void testByteBuddy() throws Exception {
.load( classLoader, ClassLoadingStrategy.Default.INJECTION )
.getLoaded();

Object object = aClass.newInstance();
Object object = aClass.getConstructor().newInstance();

Method getFieldValue = aClass.getMethod( HibernateValidatorEnhancedBean.GET_FIELD_VALUE_METHOD_NAME, String.class );

Expand Down

0 comments on commit bf9f51e

Please sign in to comment.