Add early support for mapping new synthetic ObjectMethods.bootstrap based hashCode, toString, and equals
This commit is contained in:
parent
d82596a49c
commit
81ae150537
@ -471,8 +471,8 @@ public class JarMapping {
|
||||
String oldFieldName = inputTransformer.transformFieldName(tokens[0], tokens[1]);
|
||||
String newFieldName = outputTransformer.transformFieldName(tokens[0], tokens[2]);
|
||||
|
||||
String newClassName = reverseMap.map(oldClassName);
|
||||
if (reverse) {
|
||||
String newClassName = reverseMap.map(oldClassName);
|
||||
if (newClassName.equals(oldClassName)) {
|
||||
// throw new IOException("Invalid csrg file line, could not be reversed: " + line);
|
||||
}
|
||||
@ -484,6 +484,7 @@ public class JarMapping {
|
||||
}
|
||||
|
||||
fields.put(oldClassName + "/" + oldFieldName, newFieldName);
|
||||
fields.put(newClassName + "/" + oldFieldName, newFieldName);
|
||||
} else if (tokens.length == 4) {
|
||||
String oldClassName = inputTransformer.transformClassName(tokens[0]);
|
||||
String oldMethodName = inputTransformer.transformMethodName(tokens[0], tokens[1], tokens[2]);
|
||||
@ -608,12 +609,14 @@ public class JarMapping {
|
||||
}
|
||||
|
||||
String oldEntry = oldClassName + "/" + oldFieldName;
|
||||
String newEntryHack = newClassName + "/" + oldFieldName;
|
||||
|
||||
if (fields.containsKey(oldEntry) && !newFieldName.equals(fields.get(oldEntry))) {
|
||||
throw new IllegalArgumentException("Duplicate field mapping: " + oldEntry + " ->" + newFieldName
|
||||
+ " but already mapped to " + fields.get(oldEntry) + " in line=" + line);
|
||||
}
|
||||
|
||||
fields.put(oldEntry, newFieldName);
|
||||
fields.put(newEntryHack, newFieldName);
|
||||
} else if (kind.equals("MD:")) {
|
||||
String oldFull = tokens[1];
|
||||
String newFull = tokens[3];
|
||||
|
@ -81,6 +81,7 @@ public class UnsortedRemappingMethodAdapter extends MethodRemapper {
|
||||
Object... bsmArgs) {
|
||||
|
||||
// Special case lambda metaFactory to get new name
|
||||
|
||||
if (META_FACTORIES.contains(bsm)) {
|
||||
String owner = Type.getReturnType(desc).getInternalName();
|
||||
String odesc = ((Type) bsmArgs[0]).getDescriptor(); // First constant argument is "samMethodType - Signature and return type of method to be implemented by the function object."
|
||||
@ -90,6 +91,19 @@ public class UnsortedRemappingMethodAdapter extends MethodRemapper {
|
||||
name = remapper.mapInvokeDynamicMethodName(name, desc);
|
||||
}
|
||||
|
||||
if (bsm.getOwner().equals("java/lang/runtime/ObjectMethods")) {
|
||||
// TODO: consider asserting name (the parameter) equals hashCode, toString, or equals
|
||||
|
||||
Type clazz = (Type)bsmArgs[0];
|
||||
// TODO: consider asserting (String)bsmArgs[1] == "step;feature"
|
||||
|
||||
for (int i = 2; i < bsmArgs.length; i++) {
|
||||
Handle h = (Handle)bsmArgs[i];
|
||||
String newName = remapper.mapFieldName(clazz.getInternalName(), h.getName(), h.getDesc());
|
||||
bsmArgs[i] = new Handle(h.getTag(), h.getOwner(), newName, h.getDesc(), h.isInterface());
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < bsmArgs.length; i++) {
|
||||
bsmArgs[i] = remapper.mapValue(bsmArgs[i]);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user