[ruby/yarp] Convert constant pool entries to a string type in Java Loader

* Fixes https://github.com/ruby/yarp/issues/1389
* Fields of type `string` as kept as byte[].

https://github.com/ruby/yarp/commit/234c8f47c7
This commit is contained in:
Benoit Daloze 2023-09-14 18:52:17 +02:00 коммит произвёл git
Родитель 38e98cbb6a
Коммит c47608494f
1 изменённых файлов: 6 добавлений и 3 удалений

Просмотреть файл

@ -9,6 +9,9 @@ module YARP
SERIALIZE_ONLY_SEMANTICS_FIELDS = ENV.fetch("YARP_SERIALIZE_ONLY_SEMANTICS_FIELDS", false)
JAVA_BACKEND = ENV["YARP_JAVA_BACKEND"] || "truffleruby"
JAVA_STRING_TYPE = JAVA_BACKEND == "jruby" ? "org.jruby.RubySymbol" : "String"
# This represents a field on a node. It contains all of the necessary
# information to template out the code for that field.
class Field
@ -91,7 +94,7 @@ module YARP
end
def java_type
"byte[]"
JAVA_STRING_TYPE
end
end
@ -103,7 +106,7 @@ module YARP
end
def java_type
"byte[]"
JAVA_STRING_TYPE
end
end
@ -115,7 +118,7 @@ module YARP
end
def java_type
"byte[][]"
"#{JAVA_STRING_TYPE}[]"
end
end