From ad6bc89b0bef470fbce1e1ad80ebeb22c50b56ae Mon Sep 17 00:00:00 2001 From: kares Date: Wed, 12 Jun 2024 14:05:35 +0200 Subject: [PATCH] [refactor] cleanup native impls that are now in .rb --- .../org/jruby/ext/openssl/X509Extension.java | 41 ------------------- 1 file changed, 41 deletions(-) diff --git a/src/main/java/org/jruby/ext/openssl/X509Extension.java b/src/main/java/org/jruby/ext/openssl/X509Extension.java index 129e5c6a..be9c7aac 100644 --- a/src/main/java/org/jruby/ext/openssl/X509Extension.java +++ b/src/main/java/org/jruby/ext/openssl/X509Extension.java @@ -39,7 +39,6 @@ import org.bouncycastle.asn1.ASN1Encoding; import org.bouncycastle.asn1.ASN1Integer; import org.bouncycastle.asn1.ASN1IA5String; -import org.bouncycastle.asn1.ASN1Object; import org.bouncycastle.asn1.ASN1ObjectIdentifier; import org.bouncycastle.asn1.ASN1OctetString; import org.bouncycastle.asn1.ASN1Primitive; @@ -62,7 +61,6 @@ import org.jruby.Ruby; import org.jruby.RubyArray; import org.jruby.RubyClass; -import org.jruby.RubyHash; import org.jruby.RubyModule; import org.jruby.RubyNumeric; import org.jruby.RubyObject; @@ -78,7 +76,6 @@ import static org.jruby.ext.openssl.ASN1._ASN1; import static org.jruby.ext.openssl.X509._X509; import static org.jruby.ext.openssl.OpenSSL.*; -import static org.jruby.ext.openssl.StringHelper.*; /** * OpenSSL::X509::Extension @@ -846,44 +843,6 @@ public IRubyObject eql_p(IRubyObject obj) { return equalImpl(getRuntime(), obj); } - // [ self.oid, self.value, self.critical? ] - @JRubyMethod - public RubyArray to_a(final ThreadContext context) { - RubyArray array = RubyArray.newArray(context.runtime, 3); - array.append(oid(context)); - array.append(value(context)); - array.append(critical_p(context)); - return array; - } - - // {"oid"=>self.oid,"value"=>self.value,"critical"=>self.critical? - @JRubyMethod - public RubyHash to_h(final ThreadContext context) { - final Ruby runtime = context.runtime; - RubyHash hash = RubyHash.newHash(runtime); - hash.op_aset(context, newStringFrozen(runtime, "oid"), oid(context)); - hash.op_aset(context, newStringFrozen(runtime, "value"), value(context)); - hash.op_aset(context, newStringFrozen(runtime, "critical"), critical_p(context)); - return hash; - } - - // "oid = critical, value" - @JRubyMethod - public RubyString to_s(final ThreadContext context) { - final Ruby runtime = context.runtime; - final RubyString str = RubyString.newString(runtime, oidSym(runtime)); - str.getByteList().append(' ').append('=').append(' '); - if ( isRealCritical() ) str.getByteList().append(critical__); - // self.value.gsub(/\n/, ", ") - final RubyString value = value(context); - value.callMethod(context, "gsub!", new IRubyObject[] { - RubyString.newStringShared(runtime, StringHelper.NEW_LINE), - RubyString.newStringShared(runtime, StringHelper.COMMA_SPACE) - }); - str.getByteList().append(value.getByteList()); - return str; - } - @Override public X509Extension clone() { try {