From ffbcdaeee10d72ba8a65aa1458d538a3c26fdd2a Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sun, 27 Aug 2023 09:54:36 +0200 Subject: [PATCH] feat: added type descriptor support --- build.gradle | 2 +- src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 3745265..dae1fae 100644 --- a/build.gradle +++ b/build.gradle @@ -21,7 +21,7 @@ repositories { dependencies { implementation 'commons-cli:commons-cli:1.5.0' - implementation 'ftbsc.lll:mapper:0.2.2' + implementation 'ftbsc.lll:mapper:0.2.3' implementation 'com.google.auto.service:auto-service-annotations:1.1.0' annotationProcessor 'com.google.auto.service:auto-service:1.1.0' } diff --git a/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java b/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java index 8dc955c..981ea2f 100644 --- a/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java +++ b/src/main/java/ftbsc/lll/mapper/writer/impl/TinyV2Writer.java @@ -5,6 +5,7 @@ import ftbsc.lll.mapper.IMapper; import ftbsc.lll.mapper.writer.IWriter; import java.io.PrintWriter; +import java.util.Optional; /** * An {@link IWriter} that writes in the Tiny v2 format. @@ -22,7 +23,9 @@ public class TinyV2Writer implements IWriter { mapper.getRawMappings().forEach((name, data) -> { writer.printf("c\t%s\t%s\n", name, data.nameMapped); data.getFields().forEach((fieldName, fieldData) -> - writer.printf("\tf\t?\t%s\t%s\n", fieldName, fieldData.nameMapped)); //TODO field descriptors + writer.printf("\tf\t%s\t%s\t%s\n", + Optional.ofNullable(fieldData.descriptor).orElse("?"), + fieldName, fieldData.nameMapped)); data.getMethods().forEach(((methodSignature, methodData) -> writer.printf("\tm\t%s\t%s\t%s\n", methodSignature.descriptor, methodSignature.name, methodData.nameMapped)));