Skip to content

Commit cb64a85

Browse files
committed
[fix] compat with JRuby < 9.2.10 after API change (#348)
`default_value_set` was added in JRuby 9.2.10.0, use dynamic dispatch for backward compatibility. Also lower compile-time dependency to jruby-core 9.2.0.0 to catch similar binary incompatibilities at build time.
1 parent e12ae01 commit cb64a85

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

Mavenfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ plugin :clean do
8282
'failOnError' => 'false' )
8383
end
8484

85-
jar 'org.jruby:jruby-core', '9.2.19.0', :scope => :provided
85+
jar 'org.jruby:jruby-core', '9.2.0.0', :scope => :provided
8686
# for invoker generated classes we need to add javax.annotation when on Java > 8
8787
jar 'javax.annotation:javax.annotation-api', '1.3.1', :scope => :compile
8888
jar 'junit:junit', '[4.13.1,)', :scope => :test

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ DO NOT MODIFY - GENERATED CODE
9797
<dependency>
9898
<groupId>org.jruby</groupId>
9999
<artifactId>jruby-core</artifactId>
100-
<version>9.2.19.0</version>
100+
<version>9.2.0.0</version>
101101
<scope>provided</scope>
102102
</dependency>
103103
<dependency>

src/main/java/org/jruby/ext/openssl/X509Name.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ static void createX509Name(final Ruby runtime, final RubyModule X509, final Ruby
124124

125125
final ThreadContext context = runtime.getCurrentContext();
126126
final RubyHash hash = RubyHash.newHash(runtime);
127-
hash.default_value_set(context, UTF8_STRING);
127+
// NOTE: using dynamic dispatch for compat with JRuby < 9.2.10
128+
// (default_value_set(ThreadContext, IRubyObject) was added in 9.2.10.0)
129+
hash.callMethod(context, "default=", UTF8_STRING);
128130
hash.op_aset(context, newString(runtime, new byte[] { 'C' }), PRINTABLE_STRING);
129131
final byte[] countryName = { 'c','o','u','n','t','r','y','N','a','m','e' };
130132
hash.op_aset(context, newString(runtime, countryName), PRINTABLE_STRING);

0 commit comments

Comments
 (0)