From 3dd86a41872585b7cbba4f6b4e1407316bf889c3 Mon Sep 17 00:00:00 2001 From: zaaarf Date: Fri, 1 Sep 2023 12:42:19 +0200 Subject: [PATCH] chore: updated to mapping library 0.3.0 --- build.gradle | 5 ++--- .../java/ftbsc/lll/processor/tools/ASTUtils.java | 14 +++++++------- .../lll/processor/tools/ProcessorOptions.java | 9 ++++----- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/build.gradle b/build.gradle index 2f83ee6..cdcad7b 100644 --- a/build.gradle +++ b/build.gradle @@ -7,8 +7,7 @@ archivesBaseName = 'processor' version = gitVersion() java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = targetCompatibility JavaVersion.VERSION_1_8 withSourcesJar() withJavadocJar() } @@ -22,7 +21,7 @@ dependencies { implementation 'com.squareup:javapoet:1.13.0' implementation 'org.ow2.asm:asm-commons:9.5' implementation 'ftbsc:lll:0.4.2' - implementation 'ftbsc.lll:mapper:0.2.0' + implementation 'ftbsc.lll:mapper:0.3.0' } jar { diff --git a/src/main/java/ftbsc/lll/processor/tools/ASTUtils.java b/src/main/java/ftbsc/lll/processor/tools/ASTUtils.java index 952abd1..326f52d 100644 --- a/src/main/java/ftbsc/lll/processor/tools/ASTUtils.java +++ b/src/main/java/ftbsc/lll/processor/tools/ASTUtils.java @@ -4,12 +4,12 @@ import ftbsc.lll.exceptions.AmbiguousDefinitionException; import ftbsc.lll.exceptions.MappingNotFoundException; import ftbsc.lll.exceptions.NotAProxyException; import ftbsc.lll.exceptions.TargetNotFoundException; +import ftbsc.lll.mapper.tools.Mapper; import ftbsc.lll.mapper.tools.data.ClassData; import ftbsc.lll.mapper.tools.data.FieldData; import ftbsc.lll.mapper.tools.data.MethodData; import ftbsc.lll.processor.annotations.Target; import ftbsc.lll.processor.tools.containers.ClassContainer; -import ftbsc.lll.mapper.IMapper; import ftbsc.lll.proxies.ProxyType; import javax.annotation.processing.ProcessingEnvironment; @@ -216,11 +216,11 @@ public class ASTUtils { * Gets the {@link ClassData} corresponding to the given fully-qualified name, * or creates a false one with the same, non-obfuscated name twice. * @param name the internal name of the class to convert - * @param mapper the {@link IMapper} to use, may be null + * @param mapper the {@link Mapper} to use, may be null * @return the fully qualified class name * @since 0.6.1 */ - public static ClassData getClassData(String name, IMapper mapper) { + public static ClassData getClassData(String name, Mapper mapper) { try { name = name.replace('.', '/'); //just in case if(mapper != null) @@ -236,11 +236,11 @@ public class ASTUtils { * @param parent the internal name of the parent class * @param name the name of the member * @param descriptor the descriptor of the method - * @param mapper the {@link IMapper} to use, may be null + * @param mapper the {@link Mapper} to use, may be null * @return the fully qualified class name * @since 0.6.1 */ - public static MethodData getMethodData(String parent, String name, String descriptor, IMapper mapper) { + public static MethodData getMethodData(String parent, String name, String descriptor, Mapper mapper) { try { name = name.replace('.', '/'); //just in case if(mapper != null) @@ -255,11 +255,11 @@ public class ASTUtils { * mapping is found. * @param parent the internal name of the parent class * @param name the name of the member - * @param mapper the {@link IMapper} to use, may be null + * @param mapper the {@link Mapper} to use, may be null * @return the fully qualified class name * @since 0.6.1 */ - public static FieldData getFieldData(String parent, String name, IMapper mapper) { + public static FieldData getFieldData(String parent, String name, Mapper mapper) { try { name = name.replace('.', '/'); //just in case if(mapper != null) diff --git a/src/main/java/ftbsc/lll/processor/tools/ProcessorOptions.java b/src/main/java/ftbsc/lll/processor/tools/ProcessorOptions.java index 77d0dad..70d43cc 100644 --- a/src/main/java/ftbsc/lll/processor/tools/ProcessorOptions.java +++ b/src/main/java/ftbsc/lll/processor/tools/ProcessorOptions.java @@ -1,8 +1,8 @@ package ftbsc.lll.processor.tools; import ftbsc.lll.IInjector; -import ftbsc.lll.mapper.IMapper; import ftbsc.lll.mapper.MapperProvider; +import ftbsc.lll.mapper.tools.Mapper; import javax.annotation.processing.ProcessingEnvironment; import java.util.Arrays; @@ -30,10 +30,10 @@ public class ProcessorOptions { public final ProcessingEnvironment env; /** - * The {@link IMapper} used to convert classes and variables + * The {@link Mapper} used to convert classes and variables * to their obfuscated equivalent. Will be null when no mapper is in use. */ - public final IMapper mapper; + public final Mapper mapper; /** * Whether the processor should issue warnings when compiling code anonymous @@ -61,8 +61,7 @@ public class ProcessorOptions { String location = env.getOptions().get("mappingsFile"); if(location != null) { List lines = MapperProvider.fetchFromLocalOrRemote(location); - this.mapper = MapperProvider.getMapper(lines); - this.mapper.populate(lines, true); + this.mapper = MapperProvider.getMapper(lines).getMapper(lines, true); } else this.mapper = null; this.anonymousClassWarning = parseBooleanArg(env.getOptions().get("anonymousClassWarning"), true); this.obfuscateInjectorMetadata = parseBooleanArg(env.getOptions().get("obfuscateInjectorMetadata"), true);