3030import org .jruby .*;
3131import org .jruby .anno .JRubyMethod ;
3232import org .jruby .anno .JRubyModule ;
33+ import org .jruby .common .IRubyWarnings ;
3334import org .jruby .runtime .ThreadContext ;
3435import org .jruby .runtime .Visibility ;
3536import org .jruby .runtime .builtin .IRubyObject ;
@@ -194,18 +195,14 @@ public static IRubyObject set_fips_mode(ThreadContext context, IRubyObject self,
194195 // internal (package-level) helpers :
195196
196197 /**
197- * PRIMARILY MEANT FOR TESTING ONLY, USAGE IS DISCOURAGED!
198- * @see org.jruby.ext.openssl.util.CryptoSecurity
198+ * @deprecated
199199 */
200200 @ JRubyMethod (name = "_disable_security_restrictions!" , visibility = Visibility .PRIVATE , meta = true )
201201 public static IRubyObject _disable_security_restrictions (ThreadContext context , IRubyObject self ) {
202- Boolean unrestrict = org .jruby .ext .openssl .util .CryptoSecurity .unrestrictSecurity ();
203- Boolean allPerm = org .jruby .ext .openssl .util .CryptoSecurity .setAllPermissionPolicy ();
204- if ( unrestrict == null || allPerm == null ) return context .nil ;
205- return context .runtime .newBoolean ( unrestrict && allPerm );
202+ warnDeprecated (context , "OpenSSL._disable_security_restrictions! is deprecated for removal" );
203+ return context .nil ;
206204 }
207205
208-
209206 private static boolean debug ;
210207
211208 // on by default, warnings can be disabled using -Djruby.openssl.warn=false
@@ -251,7 +248,6 @@ public static void debugStackTrace(final Ruby runtime, final CharSequence msg, f
251248 }
252249 }
253250 }
254-
255251 static void warn (final ThreadContext context , final CharSequence msg ) {
256252 if ( warn ) warn (context , RubyString .newString (context .runtime , msg ));
257253 }
@@ -264,6 +260,12 @@ static void warn(final ThreadContext context, final IRubyObject msg) {
264260 if ( warn ) context .runtime .getModule ("OpenSSL" ).callMethod (context , "warn" , msg );
265261 }
266262
263+ public static void warnDeprecated (final ThreadContext context , final CharSequence msg ) {
264+ if ( warn ) {
265+ context .runtime .getWarnings ().warn (IRubyWarnings .ID .DEPRECATED_METHOD , msg .toString ());
266+ }
267+ }
268+
267269 private static String javaVersion (final String def , final int len ) {
268270 String javaVersion = SafePropertyAccessor .getProperty ("java.version" , def );
269271 if ( "0" .equals (javaVersion ) ) javaVersion = "1.7.0" ; // Android
0 commit comments