Skip to content

Commit

Permalink
make Remapper accessing method static since itself is static
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZZank committed Apr 14, 2024
1 parent a599f4a commit d715b93
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion common/src/main/java/dev/latvian/mods/rhino/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -1982,7 +1982,7 @@ public static void setRemapper(Remapper remapper) {
ContextFactory.remapper = remapper;
}

public Remapper getRemapper() {
public static Remapper getRemapper() {
return ContextFactory.remapper;
}

Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/dev/latvian/mods/rhino/JavaMembers.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ private void reflect(Context cx, Scriptable scope, boolean includeProtected, boo
int mods = method.getModifiers();
boolean isStatic = Modifier.isStatic(mods);
Map<String, Object> ht = isStatic ? staticMembers : members;
final String mappedMethod = cx.getRemapper().getMappedMethod(cl, method);
final String mappedMethod = Context.getRemapper().getMappedMethod(cl, method);
String name = mappedMethod.isEmpty()?method.getName():mappedMethod;

Object value = ht.get(name);
Expand Down Expand Up @@ -453,7 +453,7 @@ private void reflect(Context cx, Scriptable scope, boolean includeProtected, boo

// Reflect fields.
for (Field field : getAccessibleFields(includeProtected, includePrivate)) {
String mappedField = cx.getRemapper().getMappedField(cl, field);
String mappedField = Context.getRemapper().getMappedField(cl, field);
String name = mappedField.isEmpty() ? field.getName() : mappedField;

int mods = field.getModifiers();
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/java/dev/latvian/mods/rhino/NativeJSON.java
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ private static JsonElement stringify0(Context cx, Scriptable scope, Object v) {
}
type(fName, field.getType());
fName.append(' ');
String mappedField = cx.getRemapper().getMappedField(cl, field);
String mappedField = Context.getRemapper().getMappedField(cl, field);
if (mappedField.isEmpty()) {
fName.append(field.getName());
}else{
Expand Down Expand Up @@ -420,7 +420,7 @@ private static JsonElement stringify0(Context cx, Scriptable scope, Object v) {
type(builder, method.getReturnType());
builder.append(' ');

final String mappedMethod = cx.getRemapper().getMappedMethod(cl, method);
final String mappedMethod = Context.getRemapper().getMappedMethod(cl, method);
builder.append(mappedMethod.isEmpty()?method.getName():mappedMethod);

params(builder, method.getParameterTypes());
Expand Down

0 comments on commit d715b93

Please sign in to comment.