From d0a718c1209ee64584950482f18911becded634e Mon Sep 17 00:00:00 2001 From: Charles Oliver Nutter Date: Thu, 16 Jan 2025 17:39:12 -0600 Subject: [PATCH] Loosen visibility to avoid accessor methods Java will generated accessor methods for private fields, burning some inlining budget. --- java/src/json/ext/Generator.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/java/src/json/ext/Generator.java b/java/src/json/ext/Generator.java index e9940810..cf7b5255 100644 --- a/java/src/json/ext/Generator.java +++ b/java/src/json/ext/Generator.java @@ -298,7 +298,7 @@ void generate(ThreadContext context, Session session, RubyFixnum object, OutputS } } - private static void generateFixnum(Session session, RubyFixnum object, OutputStream buffer) throws IOException { + static void generateFixnum(Session session, RubyFixnum object, OutputStream buffer) throws IOException { long i = object.getLongValue(); if (i == 0) { buffer.write('0'); @@ -339,7 +339,7 @@ void generate(ThreadContext context, Session session, RubyFloat object, OutputSt } } - private static void generateFloat(ThreadContext context, Session session, RubyFloat object, OutputStream buffer) throws IOException { + static void generateFloat(ThreadContext context, Session session, RubyFloat object, OutputStream buffer) throws IOException { double value = object.getValue(); if (Double.isInfinite(value) || Double.isNaN(value)) { @@ -370,7 +370,7 @@ void generate(ThreadContext context, Session session, RubyArray obj } } - private static void generateArray(ThreadContext context, Session session, RubyArray object, OutputStream buffer) throws IOException { + static void generateArray(ThreadContext context, Session session, RubyArray object, OutputStream buffer) throws IOException { GeneratorState state = session.getState(context); int depth = state.increaseDepth(context); @@ -431,7 +431,7 @@ void generate(ThreadContext context, final Session session, RubyHash object, fin } } - private static void generateHash(ThreadContext context, Session session, RubyHash object, OutputStream buffer) throws IOException { + static void generateHash(ThreadContext context, Session session, RubyHash object, OutputStream buffer) throws IOException { final GeneratorState state = session.getState(context); final int depth = state.increaseDepth(context); @@ -522,7 +522,7 @@ void generate(ThreadContext context, Session session, RubyString object, OutputS } } - private static void generateString(ThreadContext context, Session session, RubyString object, OutputStream buffer) throws IOException { + static void generateString(ThreadContext context, Session session, RubyString object, OutputStream buffer) throws IOException { session.getStringEncoder(context).generate(context, object, buffer); } @@ -538,12 +538,12 @@ void generate(ThreadContext context, Session session, IRubyObject object, Output } } - private static RubyString generateObjectNew(ThreadContext context, Session session, IRubyObject object) { + static RubyString generateObjectNew(ThreadContext context, Session session, IRubyObject object) { RubyString str = object.asString(); return STRING_HANDLER.generateNew(context, session, str); } - private static void generateObject(ThreadContext context, Session session, IRubyObject object, OutputStream buffer) throws IOException { + static void generateObject(ThreadContext context, Session session, IRubyObject object, OutputStream buffer) throws IOException { generateString(context, session, object.asString(), buffer); } @@ -559,7 +559,7 @@ void generate(ThreadContext context, Session session, IRubyObject object, Output } } - private static RubyString generateGenericNew(ThreadContext context, Session session, IRubyObject object) { + static RubyString generateGenericNew(ThreadContext context, Session session, IRubyObject object) { GeneratorState state = session.getState(context); if (state.strict()) { throw Utils.buildGeneratorError(context, object, object + " not allowed in JSON").toThrowable(); @@ -572,7 +572,7 @@ private static RubyString generateGenericNew(ThreadContext context, Session sess } } - private static void generateGeneric(ThreadContext context, Session session, IRubyObject object, OutputStream buffer) throws IOException { + static void generateGeneric(ThreadContext context, Session session, IRubyObject object, OutputStream buffer) throws IOException { RubyString result = generateGenericNew(context, session, object); ByteList bytes = result.getByteList(); buffer.write(bytes.unsafeBytes(), bytes.begin(), bytes.length());