Skip to content

Commit 17dc5ab

Browse files
committed
Avoid direct constructors from JRuby
These classes either have been made abstract or will be made abstract in the future. We should avoid using the direct constructors from now on.
1 parent aae2576 commit 17dc5ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static RubyString newString(final Ruby runtime, final byte[] bytes, final int co
6363
}
6464

6565
static RubyString newString(final Ruby runtime, final CharSequence chars) {
66-
return new RubyString(runtime, runtime.getString(), chars, ASCIIEncoding.INSTANCE);
66+
return RubyString.newString(runtime, chars, ASCIIEncoding.INSTANCE);
6767
}
6868

6969
static ByteList setByteListShared(final RubyString str) {
@@ -73,12 +73,12 @@ static ByteList setByteListShared(final RubyString str) {
7373

7474
static RubyString newUTF8String(final Ruby runtime, final ByteList bytes) {
7575
ByteList byteList = new ByteList(RubyEncoding.encodeUTF8(bytes), UTF8Encoding.INSTANCE, false);
76-
return new RubyString(runtime, runtime.getString(), byteList);
76+
return RubyString.newString(runtime, byteList);
7777
}
7878

7979
static RubyString newUTF8String(final Ruby runtime, final CharSequence chars) {
8080
ByteList byteList = new ByteList(RubyEncoding.encodeUTF8(chars), UTF8Encoding.INSTANCE, false);
81-
return new RubyString(runtime, runtime.getString(), byteList);
81+
return RubyString.newString(runtime, byteList);
8282
}
8383

8484
static RubyString newStringFrozen(final Ruby runtime, final ByteList bytes) {

0 commit comments

Comments
 (0)