4646import org .jruby .anno .JRubyMethod ;
4747import org .jruby .exceptions .RaiseException ;
4848import org .jruby .runtime .Arity ;
49- import org .jruby .runtime .ObjectAllocator ;
5049import org .jruby .runtime .ThreadContext ;
5150import org .jruby .runtime .builtin .IRubyObject ;
5251import org .jruby .util .ByteList ;
@@ -77,10 +76,6 @@ public class BN extends RubyObject {
7776
7877 private static final int DEFAULT_CERTAINTY = 100 ;
7978
80- private static final ObjectAllocator BN_ALLOCATOR = new ObjectAllocator () {
81- public BN allocate (Ruby runtime , RubyClass klass ) { return new BN (runtime , klass ); }
82- };
83-
8479 public static BN newBN (Ruby runtime , BigInteger value ) {
8580 return newInstance (runtime , value );
8681 }
@@ -92,7 +87,7 @@ static BN newInstance(final Ruby runtime, BigInteger value) {
9287 static void createBN (final Ruby runtime , final RubyModule OpenSSL , final RubyClass OpenSSLError ) {
9388 OpenSSL .defineClassUnder ("BNError" , OpenSSLError , OpenSSLError .getAllocator ());
9489
95- RubyClass BN = OpenSSL .defineClassUnder ("BN" , runtime .getObject (), BN_ALLOCATOR );
90+ RubyClass BN = OpenSSL .defineClassUnder ("BN" , runtime .getObject (), ( r , klass ) -> new BN ( r , klass ) );
9691 BN .includeModule ( runtime .getModule ("Comparable" ) );
9792 BN .defineAnnotatedMethods (BN .class );
9893 }
0 commit comments