diff --git a/.gitignore b/.gitignore
index 55cf3fb3..303d021c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,10 @@
/.settings/
/.classpath
/.project
+/.checkstyle
/.gradle
*.jar
*.tiny
.idea/
!src/test/resources/**
+/tiny-remapper/
diff --git a/build.gradle b/build.gradle
index 79953a83..a17541bd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,14 @@
plugins {
id 'java'
id 'maven-publish'
+ id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '6.1.0'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
-version = '0.4.0'
+version = '0.4.1'
def ENV = System.getenv()
version = version + (ENV.GITHUB_ACTIONS ? "" : "+local")
@@ -61,6 +62,11 @@ jar {
}
}
+checkstyle {
+ configFile = file("checkstyle.xml")
+ toolVersion = '8.31'
+}
+
publishing {
publications {
mavenJava(MavenPublication) {
diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 00000000..c33453fe
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/main/java/net/fabricmc/tinyremapper/AsmClassRemapper.java b/src/main/java/net/fabricmc/tinyremapper/AsmClassRemapper.java
index 37d5a7f1..22f73cb3 100644
--- a/src/main/java/net/fabricmc/tinyremapper/AsmClassRemapper.java
+++ b/src/main/java/net/fabricmc/tinyremapper/AsmClassRemapper.java
@@ -46,7 +46,7 @@
import net.fabricmc.tinyremapper.MemberInstance.MemberType;
final class AsmClassRemapper extends VisitTrackingClassRemapper {
- public AsmClassRemapper(ClassVisitor cv, AsmRemapper remapper, boolean rebuildSourceFilenames, boolean checkPackageAccess, boolean skipLocalMapping, boolean renameInvalidLocals) {
+ AsmClassRemapper(ClassVisitor cv, AsmRemapper remapper, boolean rebuildSourceFilenames, boolean checkPackageAccess, boolean skipLocalMapping, boolean renameInvalidLocals) {
super(cv, remapper);
this.rebuildSourceFilenames = rebuildSourceFilenames;
@@ -137,7 +137,7 @@ public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, Str
}
public static AnnotationRemapper createAsmAnnotationRemapper(String desc, AnnotationVisitor annotationVisitor, Remapper remapper) {
- return annotationVisitor == null ? null : new AsmAnnotationRemapper(annotationVisitor, remapper, desc);
+ return annotationVisitor == null ? null : new AsmAnnotationRemapper(desc, annotationVisitor, remapper, desc);
}
@Override
@@ -162,7 +162,7 @@ protected void onVisit(VisitKind kind) {
private MethodNode methodNode;
private static class AsmFieldRemapper extends FieldRemapper {
- public AsmFieldRemapper(FieldVisitor fieldVisitor, Remapper remapper) {
+ AsmFieldRemapper(FieldVisitor fieldVisitor, Remapper remapper) {
super(fieldVisitor, remapper);
}
@@ -178,7 +178,7 @@ public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, Str
}
private static class AsmMethodRemapper extends MethodRemapper {
- public AsmMethodRemapper(MethodVisitor methodVisitor, Remapper remapper, String owner, MethodNode methodNode, boolean checkPackageAccess, boolean skipLocalMapping, boolean renameInvalidLocals) {
+ AsmMethodRemapper(MethodVisitor methodVisitor, Remapper remapper, String owner, MethodNode methodNode, boolean checkPackageAccess, boolean skipLocalMapping, boolean renameInvalidLocals) {
super(methodNode != null ? methodNode : methodVisitor, remapper);
this.owner = owner;
@@ -277,8 +277,8 @@ public void visitInvokeDynamicInsn(String name, String descriptor, Handle bootst
bootstrapMethodArguments[i] = remapper.mapValue(bootstrapMethodArguments[i]);
}
- mv.visitInvokeDynamicInsn( // bypass remapper
- name,
+ // bypass remapper
+ mv.visitInvokeDynamicInsn(name,
remapper.mapMethodDesc(descriptor), (Handle) remapper.mapValue(bootstrapMethodHandle),
bootstrapMethodArguments);
}
@@ -613,9 +613,10 @@ private String getNameFromType(String type, boolean isArg) {
* other variable which already has that name, e.g.:
* (MyClass ?, MyClass2 ?, MyClass ?) -> (MyClass myClass, MyClass2 myClass2, !myClass2 is already taken!)
*/
- for (;nameCounts.putIfAbsent(varName, 1) != null; count++) {
- varName = baseVarName + Integer.toString(count);
+ while (nameCounts.putIfAbsent(varName, 1) != null) {
+ varName = baseVarName + Integer.toString(count++);
}
+
nameCounts.put(baseVarName, count); // update name count
return varName;
@@ -685,8 +686,8 @@ private static boolean isJavaKeyword(String s) {
}
private static class AsmAnnotationRemapper extends AnnotationRemapper {
- public AsmAnnotationRemapper(AnnotationVisitor annotationVisitor, Remapper remapper, String annotationDesc) {
- super(annotationVisitor, remapper);
+ AsmAnnotationRemapper(String descriptor, AnnotationVisitor annotationVisitor, Remapper remapper, String annotationDesc) {
+ super(descriptor, annotationVisitor, remapper);
annotationClass = Type.getType(annotationDesc).getInternalName();
}
diff --git a/src/main/java/net/fabricmc/tinyremapper/AsmRemapper.java b/src/main/java/net/fabricmc/tinyremapper/AsmRemapper.java
index 0800b6e3..b46ed3c1 100644
--- a/src/main/java/net/fabricmc/tinyremapper/AsmRemapper.java
+++ b/src/main/java/net/fabricmc/tinyremapper/AsmRemapper.java
@@ -24,7 +24,7 @@
import net.fabricmc.tinyremapper.TinyRemapper.LinkedMethodPropagation;
class AsmRemapper extends Remapper {
- public AsmRemapper(TinyRemapper remapper) {
+ AsmRemapper(TinyRemapper remapper) {
this.remapper = remapper;
}
diff --git a/src/main/java/net/fabricmc/tinyremapper/ClassInstance.java b/src/main/java/net/fabricmc/tinyremapper/ClassInstance.java
index 96ba162f..6d2afca5 100644
--- a/src/main/java/net/fabricmc/tinyremapper/ClassInstance.java
+++ b/src/main/java/net/fabricmc/tinyremapper/ClassInstance.java
@@ -133,7 +133,9 @@ public String getName() {
return name;
}
- public int getMrjVersion() { return mrjVersion; }
+ public int getMrjVersion() {
+ return mrjVersion;
+ }
public String getSuperName() {
return superName;
@@ -151,7 +153,9 @@ public boolean isPublicOrPrivate() {
return (access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PRIVATE)) != 0;
}
- public boolean isMrjCopy() { return mrjOrigin != this; }
+ public boolean isMrjCopy() {
+ return mrjOrigin != this;
+ }
public String[] getInterfaces() {
return interfaces;
@@ -165,7 +169,9 @@ public MemberInstance getMember(MemberType type, String id) {
return members.get(id);
}
- public ClassInstance getMrjOrigin() { return mrjOrigin; }
+ public ClassInstance getMrjOrigin() {
+ return mrjOrigin;
+ }
/**
* Rename the member src to dst and continue propagating in dir.
@@ -589,8 +595,11 @@ ClassInstance constructMrjCopy() {
// isInput should be false, since the MRJ copy should not be emitted
ClassInstance copy = new ClassInstance(context, false, inputTags, srcPath, data);
copy.init(name, mrjVersion, superName, access, interfaces);
- members.values().forEach(member ->
- copy.addMember(new MemberInstance(member.type, copy, member.name, member.desc, member.access)));
+
+ for (MemberInstance member : members.values()) {
+ copy.addMember(new MemberInstance(member.type, copy, member.name, member.desc, member.access));
+ }
+
// set the origin
copy.mrjOrigin = mrjOrigin;
return copy;
@@ -631,4 +640,4 @@ public static String getMrjName(String clsName, int mrjVersion) {
private String superName;
private int access;
private String[] interfaces;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/net/fabricmc/tinyremapper/FileSystemHandler.java b/src/main/java/net/fabricmc/tinyremapper/FileSystemHandler.java
index c9594ed5..480c10f1 100644
--- a/src/main/java/net/fabricmc/tinyremapper/FileSystemHandler.java
+++ b/src/main/java/net/fabricmc/tinyremapper/FileSystemHandler.java
@@ -39,7 +39,9 @@ public static synchronized FileSystem open(URI uri) throws IOException {
try {
ret = FileSystems.getFileSystem(uri);
- } catch (FileSystemNotFoundException e) { }
+ } catch (FileSystemNotFoundException e) {
+ // ignore
+ }
boolean opened;
@@ -73,7 +75,7 @@ public static synchronized void close(FileSystem fs) throws IOException {
}
private static class RefData {
- public RefData(boolean opened, int refs) {
+ RefData(boolean opened, int refs) {
this.opened = opened;
this.refs = refs;
}
diff --git a/src/main/java/net/fabricmc/tinyremapper/IMappingProvider.java b/src/main/java/net/fabricmc/tinyremapper/IMappingProvider.java
index 2afc16ed..687d3efc 100644
--- a/src/main/java/net/fabricmc/tinyremapper/IMappingProvider.java
+++ b/src/main/java/net/fabricmc/tinyremapper/IMappingProvider.java
@@ -29,7 +29,7 @@ public interface MappingAcceptor {
void acceptField(Member field, String dstName);
}
- public final class Member {
+ final class Member {
public Member(String owner, String name, String desc) {
this.owner = owner;
this.name = name;
diff --git a/src/main/java/net/fabricmc/tinyremapper/Main.java b/src/main/java/net/fabricmc/tinyremapper/Main.java
index aa6f1530..32ab7970 100644
--- a/src/main/java/net/fabricmc/tinyremapper/Main.java
+++ b/src/main/java/net/fabricmc/tinyremapper/Main.java
@@ -36,7 +36,6 @@
public class Main {
public static void main(String[] rawArgs) {
List args = new ArrayList(rawArgs.length);
- boolean reverse = false;
boolean ignoreFieldDesc = false;
boolean propagatePrivate = false;
LinkedMethodPropagation propagateBridges = LinkedMethodPropagation.DISABLED;
@@ -61,10 +60,6 @@ public static void main(String[] rawArgs) {
argKey = argKey.toLowerCase(Locale.ROOT);
switch (argKey.toLowerCase()) {
- case "reverse":
- System.err.println("WARNING: --reverse is not currently implemented!");
- reverse = true;
- break;
case "ignorefielddesc":
ignoreFieldDesc = true;
break;
@@ -122,10 +117,12 @@ public static void main(String[] rawArgs) {
break;
case "threads":
threads = Integer.parseInt(arg.substring(valueSepPos + 1));
+
if (threads <= 0) {
System.out.println("Thread count must be > 0");
System.exit(1);
}
+
break;
default:
System.out.println("invalid argument: "+arg+".");
@@ -142,14 +139,15 @@ public static void main(String[] rawArgs) {
}
Path input = Paths.get(args.get(0));
+
if (!Files.isReadable(input)) {
System.out.println("Can't read input file "+input+".");
System.exit(1);
}
Path output = Paths.get(args.get(1));
-
Path mappings = Paths.get(args.get(2));
+
if (!Files.isReadable(mappings) || Files.isDirectory(mappings)) {
System.out.println("Can't read mappings file "+mappings+".");
System.exit(1);
@@ -162,6 +160,7 @@ public static void main(String[] rawArgs) {
for (int i = 0; i < classpath.length; i++) {
classpath[i] = Paths.get(args.get(i + 5));
+
if (!Files.isReadable(classpath[i])) {
System.out.println("Can't read classpath file "+i+": "+classpath[i]+".");
System.exit(1);
diff --git a/src/main/java/net/fabricmc/tinyremapper/MemberInstance.java b/src/main/java/net/fabricmc/tinyremapper/MemberInstance.java
index 51b57cea..e434c250 100644
--- a/src/main/java/net/fabricmc/tinyremapper/MemberInstance.java
+++ b/src/main/java/net/fabricmc/tinyremapper/MemberInstance.java
@@ -136,4 +136,4 @@ enum MemberType {
private volatile String newBridgedName;
String newNameOriginatingCls;
MemberInstance bridgeTarget;
-}
\ No newline at end of file
+}
diff --git a/src/main/java/net/fabricmc/tinyremapper/MetaInfFixer.java b/src/main/java/net/fabricmc/tinyremapper/MetaInfFixer.java
index 6caf8e8a..6c889f73 100644
--- a/src/main/java/net/fabricmc/tinyremapper/MetaInfFixer.java
+++ b/src/main/java/net/fabricmc/tinyremapper/MetaInfFixer.java
@@ -17,13 +17,13 @@
public class MetaInfFixer implements OutputConsumerPath.ResourceRemapper {
public static final MetaInfFixer INSTANCE = new MetaInfFixer();
- protected MetaInfFixer() {}
+ protected MetaInfFixer() { }
@Override
public boolean canTransform(TinyRemapper remapper, Path relativePath) {
- return shouldStripForFixMeta(relativePath) ||
- relativePath.getFileName().toString().equals("MANIFEST.MF") ||
- (remapper != null && relativePath.getNameCount() == 3 && relativePath.getName(1).toString().equals("services"));
+ return shouldStripForFixMeta(relativePath)
+ || relativePath.getFileName().toString().equals("MANIFEST.MF")
+ || (remapper != null && relativePath.getNameCount() == 3 && relativePath.getName(1).toString().equals("services"));
}
@Override
diff --git a/src/main/java/net/fabricmc/tinyremapper/MetaInfRemover.java b/src/main/java/net/fabricmc/tinyremapper/MetaInfRemover.java
index 62b1ac78..401bb6a4 100644
--- a/src/main/java/net/fabricmc/tinyremapper/MetaInfRemover.java
+++ b/src/main/java/net/fabricmc/tinyremapper/MetaInfRemover.java
@@ -6,7 +6,7 @@
public class MetaInfRemover implements OutputConsumerPath.ResourceRemapper {
public static final MetaInfRemover INSTANCE = new MetaInfRemover();
- protected MetaInfRemover() {}
+ protected MetaInfRemover() { }
@Override
public boolean canTransform(TinyRemapper remapper, Path relativePath) {
diff --git a/src/main/java/net/fabricmc/tinyremapper/OutputConsumerPath.java b/src/main/java/net/fabricmc/tinyremapper/OutputConsumerPath.java
index eba933f6..22cc9575 100644
--- a/src/main/java/net/fabricmc/tinyremapper/OutputConsumerPath.java
+++ b/src/main/java/net/fabricmc/tinyremapper/OutputConsumerPath.java
@@ -18,14 +18,10 @@
package net.fabricmc.tinyremapper;
import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-import java.io.OutputStream;
import java.io.UncheckedIOException;
import java.net.URI;
import java.net.URISyntaxException;
@@ -47,7 +43,6 @@
import java.util.function.BiConsumer;
import java.util.function.Predicate;
-
public class OutputConsumerPath implements BiConsumer, Closeable {
public static class Builder {
public Builder(Path destination) {
@@ -151,7 +146,6 @@ public void addNonClassFiles(Path srcFile, TinyRemapper remapper, List> read(Path[] inputs, boolean isInp
for (FileSystem fs : fsToClose) {
try {
FileSystemHandler.close(fs);
- } catch (IOException e) { }
+ } catch (IOException e) {
+ // ignore
+ }
}
if (res != null) {
@@ -342,11 +344,6 @@ private CompletableFuture> read(Path[] inputs, boolean isInp
});
}
- @Deprecated
- private static void addClass(ClassInstance cls, Map out) {
- addClass(cls, out, true);
- }
-
private static void addClass(ClassInstance cls, Map out, boolean isVersionAware) {
// two different MRJ version will not cause warning if isVersionAware is true
String name = isVersionAware ? ClassInstance.getMrjName(cls.getName(), cls.getMrjVersion()) : cls.getName();
@@ -400,9 +397,9 @@ private List>> read(final Path file, boole
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
String name = file.getFileName().toString();
- if (name.endsWith(".jar") ||
- name.endsWith(".zip") ||
- name.endsWith(".class")) {
+ if (name.endsWith(".jar")
+ || name.endsWith(".zip")
+ || name.endsWith(".class")) {
ret.add(CompletableFuture.supplyAsync(new Supplier>() {
@Override
public List get() {
@@ -466,12 +463,14 @@ private static int analyzeMrjVersion(Path file, String name) {
private static int analyzeMrjVersion(String file, String name) {
name = name + ".class";
+
if (file.endsWith(name)) {
String prefix = file.substring(0, file.length() - name.length());
Pattern pattern = Pattern.compile("(?<=" + ClassInstance.MRJ_PREFIX + "/)[0-9]*(?=/$)");
Matcher matcher = pattern.matcher(prefix);
return matcher.find() ? Integer.parseInt(matcher.group()) : ClassInstance.MRJ_DEFAULT;
}
+
throw new RuntimeException("path " + file + " does not agree with class name " + name);
}
@@ -557,7 +556,6 @@ public void acceptMethodVar(Member method, int lvIndex, int startOpIdx, int asmI
if (dstName == null) throw new NullPointerException("null dst name");
// TODO Auto-generated method stub
-
}
@Override
@@ -768,7 +766,7 @@ private void handleConflicts() {
if (!conflicts.isEmpty() && !ignoreConflicts || unfixableConflicts || targetNameCheckFailed) {
if (ignoreConflicts || targetNameCheckFailed) System.out.println("There were unfixable conflicts.");
- System.exit(1);
+ throw new RuntimeException("Unfixable conflicts");
}
}
@@ -871,15 +869,17 @@ private void fixMrjClasses(Set versions) {
for (int toVersion: versions.stream().sorted().collect(Collectors.toList())) {
Map toClasses = new HashMap<>();
- if(mrjClasses.put(toVersion, toClasses) != null) {
+ if (mrjClasses.put(toVersion, toClasses) != null) {
throw new RuntimeException("internal error: duplicate versions in mrjClasses");
}
// find the fromVersion that just lower the the toVersion
Optional fromVersion = mrjClasses.keySet().stream()
.filter(v -> v < toVersion).max(Integer::compare);
+
if (fromVersion.isPresent()) {
Map fromClasses = mrjClasses.get(fromVersion.get());
+
for (ClassInstance cls: fromClasses.values()) {
addClass(cls.constructMrjCopy(), toClasses, false);
}
@@ -1077,7 +1077,7 @@ enum Direction {
}
class Propagation implements Runnable {
- Propagation(MemberType type, List > tasks) {
+ Propagation(MemberType type, List> tasks) {
this.type = type;
this.tasks.addAll(tasks);
}
@@ -1139,7 +1139,7 @@ public void run() {
}
private final MemberType type;
- private final List > tasks = new ArrayList >();
+ private final List> tasks = new ArrayList<>();
}
public enum LinkedMethodPropagation {
diff --git a/src/main/java/net/fabricmc/tinyremapper/TinyUtils.java b/src/main/java/net/fabricmc/tinyremapper/TinyUtils.java
index f710f534..aed4abd7 100644
--- a/src/main/java/net/fabricmc/tinyremapper/TinyUtils.java
+++ b/src/main/java/net/fabricmc/tinyremapper/TinyUtils.java
@@ -26,7 +26,14 @@
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
import java.util.function.BiConsumer;
import java.util.zip.GZIPInputStream;
@@ -37,7 +44,7 @@
public final class TinyUtils {
private static final class MemberMapping {
- public MemberMapping(Member member, String newName) {
+ MemberMapping(Member member, String newName) {
this.member = member;
this.newName = newName;
}
@@ -47,7 +54,7 @@ public MemberMapping(Member member, String newName) {
}
private static final class MethodArgMapping {
- public MethodArgMapping(Member method, int lvIndex, String newName) {
+ MethodArgMapping(Member method, int lvIndex, String newName) {
this.method = method;
this.lvIndex = lvIndex;
this.newName = newName;
@@ -59,7 +66,7 @@ public MethodArgMapping(Member method, int lvIndex, String newName) {
}
private static final class MethodVarMapping {
- public MethodVarMapping(Member method, int lvIndex, int startOpIdx, int asmIndex, String newName) {
+ MethodVarMapping(Member method, int lvIndex, int startOpIdx, int asmIndex, String newName) {
this.method = method;
this.lvIndex = lvIndex;
this.startOpIdx = startOpIdx;
@@ -75,7 +82,7 @@ public MethodVarMapping(Member method, int lvIndex, int startOpIdx, int asmIndex
private static class SimpleClassMapper extends Remapper {
final Map classMap;
- public SimpleClassMapper(Map map) {
+ SimpleClassMapper(Map map) {
this.classMap = map;
}
@@ -85,9 +92,7 @@ public String map(String typeName) {
}
}
- private TinyUtils() {
-
- }
+ private TinyUtils() { }
public static IMappingProvider createTinyMappingProvider(final Path mappings, String fromM, String toM) {
return out -> {
@@ -217,8 +222,8 @@ private static void readV1(BufferedReader reader, String from, String to,
if (toIndex < 0) throw new IOException("Could not find mapping '" + to + "'!");
Map obfFrom = fromIndex != 0 ? new HashMap<>() : null;
-
String line;
+
while ((line = reader.readLine()) != null) {
String[] splitLine = line.split("\t");
if (splitLine.length < 2) continue;
diff --git a/src/main/java/net/fabricmc/tinyremapper/VisitTrackingClassRemapper.java b/src/main/java/net/fabricmc/tinyremapper/VisitTrackingClassRemapper.java
index 1da9689b..a32f1120 100644
--- a/src/main/java/net/fabricmc/tinyremapper/VisitTrackingClassRemapper.java
+++ b/src/main/java/net/fabricmc/tinyremapper/VisitTrackingClassRemapper.java
@@ -63,7 +63,6 @@ public void visitPermittedSubclass(String permittedSubclass) {
super.visitPermittedSubclass(permittedSubclass);
}
-
@Override
public void visitOuterClass(String owner, String name, String descriptor) {
onVisit(VisitKind.OUTER_CLASS);
diff --git a/src/test/java/net/fabricmc/tinyremapper/IntegrationTest1.java b/src/test/java/net/fabricmc/tinyremapper/IntegrationTest1.java
index 612bd16a..e6ba96e3 100644
--- a/src/test/java/net/fabricmc/tinyremapper/IntegrationTest1.java
+++ b/src/test/java/net/fabricmc/tinyremapper/IntegrationTest1.java
@@ -17,13 +17,8 @@
package net.fabricmc.tinyremapper;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.Opcodes;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.File;
import java.io.IOException;
@@ -32,8 +27,13 @@
import java.util.Set;
import java.util.jar.JarFile;
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Opcodes;
public class IntegrationTest1 {
private static final String MAPPING1_PATH = "/mapping/mapping1.tiny";
@@ -57,7 +57,6 @@ public static void setup() throws IOException {
private TinyRemapper setupRemapper() {
// copy from Main.java
- final boolean reverse = false;
final boolean ignoreFieldDesc = false;
final boolean propagatePrivate = false;
final boolean removeFrames = false;
@@ -276,4 +275,4 @@ public void mrj4() throws IOException {
public static void cleanup() throws IOException {
TestUtil.folder = null;
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/net/fabricmc/tinyremapper/IntegrationTest2.java b/src/test/java/net/fabricmc/tinyremapper/IntegrationTest2.java
index 43bf2041..3cb2af9e 100644
--- a/src/test/java/net/fabricmc/tinyremapper/IntegrationTest2.java
+++ b/src/test/java/net/fabricmc/tinyremapper/IntegrationTest2.java
@@ -17,14 +17,8 @@
package net.fabricmc.tinyremapper;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.io.TempDir;
-import org.objectweb.asm.ClassReader;
-import org.objectweb.asm.ClassVisitor;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.io.File;
import java.io.IOException;
@@ -33,8 +27,14 @@
import java.util.Set;
import java.util.jar.JarFile;
-import static org.junit.jupiter.api.Assertions.assertNotEquals;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
+import org.junit.jupiter.api.AfterAll;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.io.TempDir;
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.MethodVisitor;
+import org.objectweb.asm.Opcodes;
public class IntegrationTest2 {
private static final String MAPPING2_PATH = "/mapping/mapping2.tiny";
@@ -56,7 +56,6 @@ public static void setup() throws IOException {
private TinyRemapper setupRemapper() {
// copy from Main.java
- final boolean reverse = false;
final boolean ignoreFieldDesc = false;
final boolean propagatePrivate = false;
final boolean removeFrames = false;
@@ -94,7 +93,8 @@ private TinyRemapper setupRemapper() {
}
/**
- * This is a test for package access fix
+ * This is a test for package access fix.
+ *
* @throws IOException io failure.
*/
@Test
@@ -213,4 +213,4 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
public static void cleanup() throws IOException {
TestUtil.folder = null;
}
-}
\ No newline at end of file
+}
diff --git a/src/test/java/net/fabricmc/tinyremapper/TestUtil.java b/src/test/java/net/fabricmc/tinyremapper/TestUtil.java
index 7556fcab..4876b011 100644
--- a/src/test/java/net/fabricmc/tinyremapper/TestUtil.java
+++ b/src/test/java/net/fabricmc/tinyremapper/TestUtil.java
@@ -30,10 +30,11 @@ public class TestUtil {
public static void copyFile(Class> cls, String path)
throws IOException {
- if (folder == null) { throw new RuntimeException("the temporary folder is not created"); }
+ if (folder == null) throw new RuntimeException("the temporary folder is not created");
try (InputStream input = cls.getResourceAsStream(path)) {
- if (input == null) { throw new IOException("input is null"); }
+ if (input == null) throw new IOException("input is null");
+
byte[] buffer = new byte[input.available()];
//noinspection ResultOfMethodCallIgnored
input.read(buffer);
diff --git a/src/test/java/net/fabricmc/tinyremapper/TinyRemapperTest.java b/src/test/java/net/fabricmc/tinyremapper/TinyRemapperTest.java
index e01f278d..5266352a 100644
--- a/src/test/java/net/fabricmc/tinyremapper/TinyRemapperTest.java
+++ b/src/test/java/net/fabricmc/tinyremapper/TinyRemapperTest.java
@@ -1,11 +1,11 @@
package net.fabricmc.tinyremapper;
-import org.junit.jupiter.api.Test;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
-import static org.junit.jupiter.api.Assertions.assertEquals;
+import org.junit.jupiter.api.Test;
class TinyRemapperTest {
@Test
@@ -44,4 +44,4 @@ public void analyzeMrjVersion()
result = (Integer) getMrjVersionFromPathMethod.invoke(null, input, name);
assertEquals(ClassInstance.MRJ_DEFAULT, result);
}
-}
\ No newline at end of file
+}