summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2023-09-14 18:52:17 +0200
committergit <[email protected]>2023-09-20 01:16:54 +0000
commitc47608494f961d2a8fe24b1a7b7f627b305cf7fe (patch)
tree1cd3314d2c063e4545382466090be75e46853973
parent38e98cbb6a29f984795504fbc64872526edd1197 (diff)
[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
-rwxr-xr-xyarp/templates/template.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/yarp/templates/template.rb b/yarp/templates/template.rb
index 030c3425f6..8d02b22231 100755
--- a/yarp/templates/template.rb
+++ b/yarp/templates/template.rb
@@ -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