Skip to content

Commit

Permalink
Loosen visibility to avoid accessor methods
Browse files Browse the repository at this point in the history
Java will generated accessor methods for private fields, burning
some inlining budget.
  • Loading branch information
headius committed Jan 16, 2025
1 parent 9de3120 commit d0a718c
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions java/src/json/ext/Generator.java
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -370,7 +370,7 @@ void generate(ThreadContext context, Session session, RubyArray<IRubyObject> obj
}
}

private static void generateArray(ThreadContext context, Session session, RubyArray<IRubyObject> object, OutputStream buffer) throws IOException {
static void generateArray(ThreadContext context, Session session, RubyArray<IRubyObject> object, OutputStream buffer) throws IOException {
GeneratorState state = session.getState(context);
int depth = state.increaseDepth(context);

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);
}

Expand All @@ -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);
}

Expand All @@ -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();
Expand All @@ -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());
Expand Down

0 comments on commit d0a718c

Please sign in to comment.