Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/main/java/net/fabricmc/tinyremapper/ClassInstance.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

package net.fabricmc.tinyremapper;

import java.nio.file.Path;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -51,12 +50,12 @@
import net.fabricmc.tinyremapper.api.TrMethod;

public final class ClassInstance implements TrClass {
ClassInstance(TinyRemapper tr, boolean isInput, InputTag[] inputTags, Path srcFile, byte[] data) {
ClassInstance(TinyRemapper tr, boolean isInput, InputTag[] inputTags, String source, byte[] data) {
assert !isInput || data != null;
this.tr = tr;
this.isInput = isInput;
this.inputTags = inputTags;
this.srcPath = srcFile;
this.source = source;
this.data = data;
this.mrjOrigin = this;
}
Expand Down Expand Up @@ -837,7 +836,7 @@ private static <T extends TrMember> void addMatching(T member, String name, Stri

ClassInstance constructMrjCopy(MrjState newContext) {
// isInput should be false, since the MRJ copy should not be emitted
ClassInstance copy = new ClassInstance(tr, false, inputTags, srcPath, data);
ClassInstance copy = new ClassInstance(tr, false, inputTags, source, data);
copy.init(mrjVersion, name, signature, superName, access, interfaces);
copy.setContext(newContext);

Expand Down Expand Up @@ -870,6 +869,10 @@ public static String getMrjName(String clsName, int mrjVersion) {
}
}

/**
* @deprecated Please use {@link TrEnvironment#DEFAULT_MRJ_VERSION}.
*/
@Deprecated
public static final int MRJ_DEFAULT = -1;
public static final String MRJ_PREFIX = "/META-INF/versions";

Expand All @@ -882,7 +885,7 @@ public static String getMrjName(String clsName, int mrjVersion) {

final boolean isInput;
private volatile InputTag[] inputTags; // cow input tag list, null for none
final Path srcPath;
final String source;
byte[] data;
private ClassInstance mrjOrigin;
private final Map<String, MemberInstance> members = new HashMap<>(); // methods and fields are distinct due to their different desc separators
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/net/fabricmc/tinyremapper/FileSystemHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.FileSystem;
import java.nio.file.FileSystemAlreadyExistsException;
import java.nio.file.FileSystemNotFoundException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.util.Collections;
import java.util.IdentityHashMap;
import java.util.Map;
Expand All @@ -36,6 +38,14 @@
* invocations are mirrored.
*/
public final class FileSystemHandler {
public static synchronized FileSystem open(Path path) throws IOException {
try {
return open(new URI("jar:" + path.toUri()));
} catch (URISyntaxException e) {
throw new RuntimeException(e);
}
}

public static synchronized FileSystem open(URI uri) throws IOException {
boolean opened = false;
FileSystem ret = null;
Expand Down
Loading