Skip to content

Commit cfcce31

Browse files
mgmt, remove AccessController (Azure#29334)
1 parent 722efc7 commit cfcce31

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

sdk/resourcemanager/azure-resourcemanager-test/src/main/java/com/azure/resourcemanager/test/ResourceManagerTestBase.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
import java.security.KeyPair;
4545
import java.security.KeyPairGenerator;
4646
import java.security.NoSuchAlgorithmException;
47-
import java.security.PrivilegedAction;
4847
import java.security.PublicKey;
4948
import java.security.interfaces.RSAPublicKey;
5049
import java.time.Duration;
@@ -395,12 +394,10 @@ protected <T> void setInternalContext(T internalContext, Object... objects) {
395394
}
396395
}
397396

398-
@SuppressWarnings("removal")
399397
private void setAccessible(final AccessibleObject accessibleObject) {
400-
java.security.AccessController.doPrivileged((PrivilegedAction<Object>) () -> {
401-
accessibleObject.setAccessible(true);
402-
return null;
403-
});
398+
// avoid bug in Java8
399+
Runnable runnable = () -> accessibleObject.setAccessible(true);
400+
runnable.run();
404401
}
405402

406403
/**
@@ -413,7 +410,6 @@ private void setAccessible(final AccessibleObject accessibleObject) {
413410
* @return the manager instance
414411
* @throws RuntimeException when field cannot be found or set.
415412
*/
416-
@SuppressWarnings("removal")
417413
protected <T> T buildManager(Class<T> manager, HttpPipeline httpPipeline, AzureProfile profile) {
418414
try {
419415
Constructor<T> constructor = manager.getDeclaredConstructor(httpPipeline.getClass(), profile.getClass());

0 commit comments

Comments
 (0)