feat: added type descriptor support

This commit is contained in:
zaaarf 2023-08-27 09:54:36 +02:00
parent bbea72ed47
commit ffbcdaeee1
No known key found for this signature in database
GPG key ID: 6445A5CD15E5B40C
2 changed files with 5 additions and 2 deletions

View file

@ -21,7 +21,7 @@ repositories {
dependencies { dependencies {
implementation 'commons-cli:commons-cli:1.5.0' 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' implementation 'com.google.auto.service:auto-service-annotations:1.1.0'
annotationProcessor 'com.google.auto.service:auto-service:1.1.0' annotationProcessor 'com.google.auto.service:auto-service:1.1.0'
} }

View file

@ -5,6 +5,7 @@ import ftbsc.lll.mapper.IMapper;
import ftbsc.lll.mapper.writer.IWriter; import ftbsc.lll.mapper.writer.IWriter;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Optional;
/** /**
* An {@link IWriter} that writes in the Tiny v2 format. * An {@link IWriter} that writes in the Tiny v2 format.
@ -22,7 +23,9 @@ public class TinyV2Writer implements IWriter {
mapper.getRawMappings().forEach((name, data) -> { mapper.getRawMappings().forEach((name, data) -> {
writer.printf("c\t%s\t%s\n", name, data.nameMapped); writer.printf("c\t%s\t%s\n", name, data.nameMapped);
data.getFields().forEach((fieldName, fieldData) -> 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) -> data.getMethods().forEach(((methodSignature, methodData) ->
writer.printf("\tm\t%s\t%s\t%s\n", methodSignature.descriptor, writer.printf("\tm\t%s\t%s\t%s\n", methodSignature.descriptor,
methodSignature.name, methodData.nameMapped))); methodSignature.name, methodData.nameMapped)));