File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed
byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/loading Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -130,21 +130,23 @@ abstract class AbstractBase implements ClassInjector {
130130 * A permission for the {@code suppressAccessChecks} permission or {@code null} if not supported.
131131 */
132132 @ MaybeNull
133- protected static final Permission SUPPRESS_ACCESS_CHECKS ;
133+ protected static final Permission SUPPRESS_ACCESS_CHECKS = toSuppressAccessChecks () ;
134134
135- /*
136- * Resolves the permission for suppressing access checks.
135+ /**
136+ * Returns a permission for the {@code suppressAccessChecks} permission or {@code null} if not supported.
137+ *
138+ * @return A permission for the {@code suppressAccessChecks} permission or {@code null} if not supported.
137139 */
138- static {
139- Permission suppressAccessChecks ;
140+ @ MaybeNull
141+ @ SuppressFBWarnings (value = "REC_CATCH_EXCEPTION" , justification = "Exception should not be rethrown define null as value." )
142+ private static Permission toSuppressAccessChecks () {
140143 try {
141- suppressAccessChecks = (Permission ) Class .forName ("java.lang.reflect.ReflectPermission" )
144+ return (Permission ) Class .forName ("java.lang.reflect.ReflectPermission" )
142145 .getConstructor (String .class )
143146 .newInstance ("suppressAccessChecks" );
144147 } catch (Exception ignored ) {
145- suppressAccessChecks = null ;
148+ return null ;
146149 }
147- SUPPRESS_ACCESS_CHECKS = suppressAccessChecks ;
148150 }
149151
150152 /**
You can’t perform that action at this time.
0 commit comments