cadixdev / mercury Goto Github PK
View Code? Open in Web Editor NEWA source transformation and -remapping framework for Java.
License: Eclipse Public License 2.0
A source transformation and -remapping framework for Java.
License: Eclipse Public License 2.0
At the moment there is no way of adding a single java file or single class file to the classpath, nor can a virtual file system (like Jimfs) be used
If you attempt to remap a .java file that is just a package declaration and imports, Mercury will NullPointerException.
We need a better system for unit tests - where we don't need to review the differences when there are fails.
If a class is remapped to the default package, any imports for it should be removed.
Currently:
import net.minecraft.client.MinecraftClient
vvv
import ave
should be:
import net.minecraft.client.MinecraftClient
vvv
The inner class Entry
is defined in it.unimi.dsi.fastutil.longs.Long2ObjectMap
and java.util.Map.Entry
, but it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap
extends it.unimi.dsi.fastutil.longs.Long2ObjectMap
.
So someone wrote the following code.
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
...
for(Long2ObjectLinkedOpenHashMap.Entry entry : map.entries())
...
This lead to crash because mercury can't resolve Long2ObjectLinkedOpenHashMap.Entry
. However, javac
resolves this as it.unimi.dsi.fastutil.longs.Long2ObjectMap$Entry
.
Currently when you use Mecury and Lorenz 0.6.0-SNAPSHOT the following error message is thrown
Found class org.cadixdev.lorenz.MappingSet, but interface was expected
This error is caused by class mismatch. Mercury using Lorenz 0.5.x and the project using Mercury is depending on 0.6.0-SNAPSHOT.
Would be helpful if you are willing to deploy a version that is build against the snapshot version of Lorenz.
dependsOn #21
I've been attempting to make a simple test case to try some things out, but I can't get Mercury to play ball. Having stepped through the debugger it appears JDT can't find the bindings for any of the inputs, so any binding#getDeclaringClass()
returns null
in SimpleRemapperVisitor
. Any help or general pointers to why it doesn't want to work would be much appreciated.
I've been using the following code (along with the latest dependencies pulled from the repo), with the attached files:
private static final Path STUFF = Paths.get("<path/to/files>");
public static void main(String[] args) throws Exception {
Path input = STUFF.resolve("forge");
assert Files.isDirectory(input);
Path output = STUFF.resolve("output");
Mercury mercury = new Mercury();
Path classpath = STUFF.resolve("AnvilBlockAlso.jar");
assert Files.isRegularFile(classpath);
mercury.getClassPath().add(classpath);
mercury.getProcessors().add(MercuryRemapper.create(makeMappings()));
mercury.rewrite(input, output);
}
private static MappingSet makeMappings() {
MappingSet out = MappingSet.create();
//Just some mappings to exist for Mercury to find
ClassMapping<?, ?> classMapping = out.getOrCreateClassMapping("AnvilBlockAlso");
MethodMapping methodMapping = classMapping.getOrCreateMethodMapping("test", "(IDJII)V");
methodMapping.setDeobfuscatedName("goodTest");
return out;
}
See FabricMC/fabric-loom#45 for examination.
Not sure if upstream will be interested in fixing this, or if a patch should be provided by Mercury, or both - up to you.
As mentioned in the cadix Discord, ever since switching to a setup with split mixin/accessor/main source sets, my remapSourcesJar task has failed with this error.
This is occurring in the Confabricate project. My build setup is a bit funky -- the most relevant piece of code for classpath shenanigans is probably https://github.com/zml2008/gradle-plugins/blob/05b31098fad6c008b19818f5b19852397eab1669/opinionated-fabric/src/main/kotlin/ca/stellardrift/build/fabric/OpinionatedFabric.kt#L143.
I'd appreciate some help tracking down what the source of the error is :)
The issue occurred when trying to migrateMappings
in a Fabric project (running Loom 0.8, 1.16.5 mod). May be an issue with some Java 16 feature, that class uses at least var
. Assumed it's a Mercury issue since it's present in many positions in the stacktrace.
java.lang.RuntimeException: Failed to process: path\to\altrisi\scarpetapptester\config\GSONRecordAdapter.java
at org.cadixdev.mercury.Mercury.accept(Mercury.java:237)
at org.cadixdev.mercury.Mercury$Requestor.acceptAST(Mercury.java:260)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1068)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:662)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1013)
at org.cadixdev.mercury.Mercury.run(Mercury.java:212)
at org.cadixdev.mercury.Mercury.rewrite(Mercury.java:167)
at net.fabricmc.loom.task.MigrateMappingsTask.migrateMappings(MigrateMappingsTask.java:189)
at net.fabricmc.loom.task.MigrateMappingsTask.doTask(MigrateMappingsTask.java:104)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.doExecute(StandardTaskAction.java:58)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:51)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:29)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$2.run(ExecuteActionsTaskExecuter.java:498)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:29)
at org.gradle.internal.operations.DefaultBuildOperationRunner$1.execute(DefaultBuildOperationRunner.java:26)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.run(DefaultBuildOperationRunner.java:56)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$run$1(DefaultBuildOperationExecutor.java:71)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.runWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:45)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:71)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:483)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:466)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:105)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:270)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:248)
at org.gradle.internal.execution.steps.ExecuteStep.executeInternal(ExecuteStep.java:83)
at org.gradle.internal.execution.steps.ExecuteStep.access$000(ExecuteStep.java:37)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:50)
at org.gradle.internal.execution.steps.ExecuteStep$1.call(ExecuteStep.java:47)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:47)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:37)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:68)
at org.gradle.internal.execution.steps.RemovePreviousOutputsStep.execute(RemovePreviousOutputsStep.java:38)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:50)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:36)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:41)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:74)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:55)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:51)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:29)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:54)
at org.gradle.internal.execution.steps.CaptureStateAfterExecutionStep.execute(CaptureStateAfterExecutionStep.java:35)
at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:60)
at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:27)
at org.gradle.internal.execution.steps.BuildCacheStep.executeWithoutCache(BuildCacheStep.java:174)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:74)
at org.gradle.internal.execution.steps.BuildCacheStep.execute(BuildCacheStep.java:45)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:40)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:29)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:36)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:22)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:99)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:92)
at java.base/java.util.Optional.map(Optional.java:260)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:52)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:36)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:84)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:41)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:27)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:91)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:78)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:49)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:105)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:50)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:86)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:86)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:32)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:38)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:43)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:31)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.lambda$execute$0(AssignWorkspaceStep.java:40)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution$2.withWorkspace(ExecuteActionsTaskExecuter.java:283)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:40)
at org.gradle.internal.execution.steps.AssignWorkspaceStep.execute(AssignWorkspaceStep.java:30)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:37)
at org.gradle.internal.execution.steps.IdentityCacheStep.execute(IdentityCacheStep.java:27)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:49)
at org.gradle.internal.execution.steps.IdentifyStep.execute(IdentifyStep.java:35)
at org.gradle.internal.execution.impl.DefaultExecutionEngine$1.execute(DefaultExecutionEngine.java:76)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:184)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:173)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:109)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:200)
at org.gradle.internal.operations.DefaultBuildOperationRunner$CallableBuildOperationWorker.execute(DefaultBuildOperationRunner.java:195)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:75)
at org.gradle.internal.operations.DefaultBuildOperationRunner$3.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:153)
at org.gradle.internal.operations.DefaultBuildOperationRunner.execute(DefaultBuildOperationRunner.java:68)
at org.gradle.internal.operations.DefaultBuildOperationRunner.call(DefaultBuildOperationRunner.java:62)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.lambda$call$2(DefaultBuildOperationExecutor.java:76)
at org.gradle.internal.operations.UnmanagedBuildOperationWrapper.callWithUnmanagedSupport(UnmanagedBuildOperationWrapper.java:54)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:76)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:74)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:408)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:395)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:388)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:374)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: java.lang.IllegalArgumentException: Invalid identifier : >[Ljava<
at org.eclipse.jdt.core.dom.SimpleName.setIdentifier(SimpleName.java:243)
at org.eclipse.jdt.core.dom.AST.newSimpleName(AST.java:2597)
at org.eclipse.jdt.core.dom.AST.newName(AST.java:2285)
at org.cadixdev.mercury.remapper.RemapperVisitor.remapType(RemapperVisitor.java:124)
at org.cadixdev.mercury.remapper.RemapperVisitor.visit(RemapperVisitor.java:178)
at org.cadixdev.mercury.remapper.SimpleRemapperVisitor.visit(SimpleRemapperVisitor.java:183)
at org.eclipse.jdt.core.dom.SimpleName.accept0(SimpleName.java:198)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.SimpleType.accept0(SimpleType.java:195)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.VariableDeclarationStatement.accept0(VariableDeclarationStatement.java:253)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:128)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.IfStatement.accept0(IfStatement.java:183)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:128)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:617)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.AnonymousClassDeclaration.accept0(AnonymousClassDeclaration.java:135)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.ClassInstanceCreation.accept0(ClassInstanceCreation.java:305)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.ReturnStatement.accept0(ReturnStatement.java:128)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:128)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:617)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:447)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:258)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.cadixdev.mercury.remapper.MercuryRemapper.rewrite(MercuryRemapper.java:54)
at org.cadixdev.mercury.SourceRewriter.process(SourceRewriter.java:20)
at org.cadixdev.mercury.SourceContext.process(SourceContext.java:82)
at org.cadixdev.mercury.RewriteContext.process(RewriteContext.java:106)
at org.cadixdev.mercury.Mercury.accept(Mercury.java:235)
... 136 more
:remapped project written to path\to\remappedSrc
package altrisi.scarpetapptester.config;
import java.io.IOException;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.TypeAdapterFactory;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
class GSONRecordAdapter implements TypeAdapterFactory {
@Override
public <T> TypeAdapter<T> create(Gson gson, TypeToken<T> type) {
@SuppressWarnings("unchecked")
Class<T> clazz = (Class<T>) type.getRawType();
if (!clazz.isRecord()) {
return null;
}
TypeAdapter<T> delegate = gson.getDelegateAdapter(this, type);
return new TypeAdapter<T>() {
@Override
public void write(JsonWriter out, T value) throws IOException {
delegate.write(out, value);
}
@Override
public T read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull();
return null;
} else {
var recordComponents = clazz.getRecordComponents();
var typeMap = new HashMap<String,TypeToken<?>>();
for (int i = 0; i < recordComponents.length; i++) {
typeMap.put(recordComponents[i].getName(), TypeToken.get(recordComponents[i].getGenericType()));
}
var argsMap = new HashMap<String,Object>();
reader.beginObject();
while (reader.hasNext()) {
String name = reader.nextName();
argsMap.put(name, gson.getAdapter(typeMap.get(name)).read(reader));
}
reader.endObject();
var argTypes = new Class<?>[recordComponents.length];
var args = new Object[recordComponents.length];
for (int i = 0; i < recordComponents.length; i++) {
argTypes[i] = recordComponents[i].getType();
args[i] = argsMap.get(recordComponents[i].getName());
}
Constructor<T> constructor;
try {
constructor = clazz.getDeclaredConstructor(argTypes);
constructor.setAccessible(true);
return constructor.newInstance(args);
} catch (IllegalArgumentException | ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
}
};
}
}
Also (not sure if this is an issue with Mercury or not), after removing that class and running migrateMappings
again, classes which declared records as nested classes got a failing import record;
in their list of imports, and var
was replaced with the actual type.
Whether or not this is intended behaviour is debatable - as there are potential legitimate use-cases for this (in my case: I'm distributing a loader which has an optional dependency that is only pulled in sometimes, yet the source is always remapped), I think it should be at least an option with potential problems (such as not catching superclasses on which missing classes are on the chain) explained to the API user.
Hotfix I made for personal use, might be helpful: asiekierka@c13660e
import static org.spongepowered.api.data.DataQuery.*
in NbtTranslator
(and everywhere else it's used) doesn't get remapped
Parameter names should be remapped since we don't want to keep mismatched names (MCP parameters with Yarn class names wouldn't be very nice ๐)
This may be a useful feature for fabric to retain minecraft member reference across remapping.
Example:
public abstract EntityAgeable createChild(EntityAgeable entityageable);
Overridden:
@Override
public EntityBee createChild(EntityAgeable entityageable) {
return (EntityBee) EntityTypes.BEE.a(this.world);
}
SRG:
MD: net/minecraft/server/EntityAgeable/createChild (Lnet/minecraft/server/EntityAgeable;)Lnet/minecraft/server/EntityAgeable; net/minecraft/world/entity/AgableMob/getBreedOffspring (Lnet/minecraft/world/entity/AgableMob;)Lnet/minecraft/world/entity/AgableMob;
this will remap the method in EntityAgeable, but not in EntityBee, because the return types don't match. Java allows overriding methods with different return types, if the type is a subclass of the OG return type.
This is fixable by adding extra SRGs for the subclasses, but thats rather annoying:
MD: net/minecraft/server/EntityBee/createChild (Lnet/minecraft/server/EntityAgeable;)Lnet/minecraft/server/EntityBee; net/minecraft/world/entity/animal/Bee/getBreedOffspring (Lnet/minecraft/world/entity/AgableMob;)Lnet/minecraft/world/entity/animal/Bee;
Javadocs don't need to build for a program to compile, so preferably they'd just get passed over if they can't be remapped.
error (gradle exception stripped)
sample of crashing code
It looks like this project is not available on sonatype
https://oss.sonatype.org/#nexus-search;classname~org.cadixdev
Can somebody trigger a rerun on travis or smth?
In the commit for SpongeCommon, there's a migration of ImmutableValue
-> Value.Immutable
, but it appears that instead of importing the outer class, it will fully qualify the class in usage, resulting in long lines.
I'm working on porting a certain tech mod to Fabric from Forge, which means a few platform class names are errored out/not available in the environment.
Today, I used migrateMappings to move the in-progress port from 1.16.1+build.20 to 1.16.2+build.1. It went mostly smoothly, except that the task added imports for all the unknown forge classes. The old forge import lines had already been deleted by a regex earlier.
import vazkii.botania.api.mana.IManaReceiver;
import vazkii.botania.common.block.tile.ModTiles;
import vazkii.botania.common.block.tile.TileMod;
import IEnergyStorage; // <-- ???
import LazyOptional; // <-- ???
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
likely related to #16
This is a copy of FabricMC/fabric-loom#341 to track the issue our end.
During the build process, if a Javadoc uses {@link package.here.not.class}
an exception will be thrown during remapSourcesJar.
I've made a quick change to the Fabric example mod to demonstrate.
The exception:
https://gist.github.com/The-Fireplace/17364d63fb80d1aa8e07bad6bd3de982
Tested with Loom 0.5-SNAPSHOT
I have trouble rewriting code written with fastutil classes.
sample line
final Long2ObjectLinkedOpenHashMap.Entry<PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<E>> entry = iterator.next();
Long2ObjectMap defines an inner class Entry, that is accessed via Long2ObjectLinkedOpenHashMap.Entry in this code (Long2ObjectLinkedOpenHashMap is a child of Long2ObjectMap)
doesnt happen with
final Long2ObjectMap.Entry<PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<E>> entry = iterator.next();
I added this to visit(QualifiedNode) to see whats going on
if (binding == null) {
throw new IllegalStateException("No binding for qualified name node " + node.getFullyQualifiedName());
}
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':mercury'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.lambda$executeIfValid$1(ExecuteActionsTaskExecuter.java:205)
at org.gradle.internal.Try$Failure.ifSuccessfulOrElse(Try.java:263)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:203)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:184)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:114)
at org.gradle.api.internal.tasks.execution.FinalizePropertiesTaskExecuter.execute(FinalizePropertiesTaskExecuter.java:46)
at org.gradle.api.internal.tasks.execution.ResolveTaskExecutionModeExecuter.execute(ResolveTaskExecutionModeExecuter.java:62)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:57)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:56)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.executeTask(EventFiringTaskExecuter.java:77)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:55)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter$1.call(EventFiringTaskExecuter.java:52)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:416)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:406)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:102)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
at org.gradle.api.internal.tasks.execution.EventFiringTaskExecuter.execute(EventFiringTaskExecuter.java:52)
at org.gradle.execution.plan.LocalTaskNodeExecutor.execute(LocalTaskNodeExecutor.java:41)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:372)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$InvokeNodeExecutorsAction.execute(DefaultTaskExecutionGraph.java:359)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:352)
at org.gradle.execution.taskgraph.DefaultTaskExecutionGraph$BuildOperationAwareExecutionAction.execute(DefaultTaskExecutionGraph.java:338)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.lambda$run$0(DefaultPlanExecutor.java:127)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.execute(DefaultPlanExecutor.java:191)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.executeNextNode(DefaultPlanExecutor.java:182)
at org.gradle.execution.plan.DefaultPlanExecutor$ExecutorWorker.run(DefaultPlanExecutor.java:124)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
Caused by: java.lang.RuntimeException: Failed to process: /mnt/d/IntellijProjects/Toothpick/MiniPaper-Server/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java
at org.cadixdev.mercury.Mercury.accept(Mercury.java:210)
at org.cadixdev.mercury.Mercury$Requestor.acceptAST(Mercury.java:233)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1068)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:662)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1012)
at org.cadixdev.mercury.Mercury.run(Mercury.java:185)
at org.cadixdev.mercury.Mercury.rewrite(Mercury.java:140)
at toothpick.RemapMercuryKt$remap3$mercury$2$1.execute(remapMercury.kt:43)
at toothpick.RemapMercuryKt$remap3$mercury$2$1.execute(remapMercury.kt)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:727)
at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:694)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$3.run(ExecuteActionsTaskExecuter.java:568)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:402)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:394)
at org.gradle.internal.operations.DefaultBuildOperationExecutor$1.execute(DefaultBuildOperationExecutor.java:165)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:250)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:158)
at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:92)
at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:553)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:536)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.access$300(ExecuteActionsTaskExecuter.java:109)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.executeWithPreviousOutputFiles(ExecuteActionsTaskExecuter.java:276)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$TaskExecution.execute(ExecuteActionsTaskExecuter.java:265)
at org.gradle.internal.execution.steps.ExecuteStep.lambda$execute$1(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:33)
at org.gradle.internal.execution.steps.ExecuteStep.execute(ExecuteStep.java:26)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:67)
at org.gradle.internal.execution.steps.CleanupOutputsStep.execute(CleanupOutputsStep.java:36)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:49)
at org.gradle.internal.execution.steps.ResolveInputChangesStep.execute(ResolveInputChangesStep.java:34)
at org.gradle.internal.execution.steps.CancelExecutionStep.execute(CancelExecutionStep.java:43)
at org.gradle.internal.execution.steps.TimeoutStep.executeWithoutTimeout(TimeoutStep.java:73)
at org.gradle.internal.execution.steps.TimeoutStep.execute(TimeoutStep.java:54)
at org.gradle.internal.execution.steps.CatchExceptionStep.execute(CatchExceptionStep.java:34)
at org.gradle.internal.execution.steps.CreateOutputsStep.execute(CreateOutputsStep.java:44)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:54)
at org.gradle.internal.execution.steps.SnapshotOutputsStep.execute(SnapshotOutputsStep.java:38)
at org.gradle.internal.execution.steps.BroadcastChangingOutputsStep.execute(BroadcastChangingOutputsStep.java:49)
at org.gradle.internal.execution.steps.CacheStep.executeWithoutCache(CacheStep.java:159)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:72)
at org.gradle.internal.execution.steps.CacheStep.execute(CacheStep.java:43)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:44)
at org.gradle.internal.execution.steps.StoreExecutionStateStep.execute(StoreExecutionStateStep.java:33)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:38)
at org.gradle.internal.execution.steps.RecordOutputsStep.execute(RecordOutputsStep.java:24)
at org.gradle.internal.execution.steps.SkipUpToDateStep.executeBecause(SkipUpToDateStep.java:92)
at org.gradle.internal.execution.steps.SkipUpToDateStep.lambda$execute$0(SkipUpToDateStep.java:85)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:55)
at org.gradle.internal.execution.steps.SkipUpToDateStep.execute(SkipUpToDateStep.java:39)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:76)
at org.gradle.internal.execution.steps.ResolveChangesStep.execute(ResolveChangesStep.java:37)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:36)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsFinishedStep.execute(MarkSnapshottingInputsFinishedStep.java:26)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:94)
at org.gradle.internal.execution.steps.ResolveCachingStateStep.execute(ResolveCachingStateStep.java:49)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:79)
at org.gradle.internal.execution.steps.CaptureStateBeforeExecutionStep.execute(CaptureStateBeforeExecutionStep.java:53)
at org.gradle.internal.execution.steps.ValidateStep.execute(ValidateStep.java:74)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.lambda$execute$2(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:78)
at org.gradle.internal.execution.steps.SkipEmptyWorkStep.execute(SkipEmptyWorkStep.java:34)
at org.gradle.internal.execution.steps.legacy.MarkSnapshottingInputsStartedStep.execute(MarkSnapshottingInputsStartedStep.java:39)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:40)
at org.gradle.internal.execution.steps.LoadExecutionStateStep.execute(LoadExecutionStateStep.java:28)
at org.gradle.internal.execution.impl.DefaultWorkExecutor.execute(DefaultWorkExecutor.java:33)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeIfValid(ExecuteActionsTaskExecuter.java:192)
... 30 more
Caused by: java.lang.IllegalStateException: No binding for qualified name node Long2ObjectLinkedOpenHashMap.Entry
at org.cadixdev.mercury.remapper.RemapperVisitor.visit(RemapperVisitor.java:164)
at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:159)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2922)
at org.eclipse.jdt.core.dom.SimpleType.accept0(SimpleType.java:195)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2922)
at org.eclipse.jdt.core.dom.ParameterizedType.accept0(ParameterizedType.java:164)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2922)
at org.eclipse.jdt.core.dom.VariableDeclarationStatement.accept0(VariableDeclarationStatement.java:253)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2945)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:128)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2922)
at org.eclipse.jdt.core.dom.ForStatement.accept0(ForStatement.java:218)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2945)
at org.eclipse.jdt.core.dom.Block.accept0(Block.java:128)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2922)
at org.eclipse.jdt.core.dom.MethodDeclaration.accept0(MethodDeclaration.java:617)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2945)
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:447)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2945)
at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:258)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2874)
at org.cadixdev.mercury.remapper.MercuryRemapper.rewrite(MercuryRemapper.java:44)
at org.cadixdev.mercury.SourceRewriter.process(SourceRewriter.java:20)
at org.cadixdev.mercury.SourceContext.process(SourceContext.java:82)
at org.cadixdev.mercury.RewriteContext.process(RewriteContext.java:106)
at org.cadixdev.mercury.Mercury.accept(Mercury.java:208)
... 96 more
SRG:
MD: net/minecraft/server/AxisAlignedBB/contains (DDD)Z net/minecraft/world/phys/AABB/containsOH (DDD)Z
MD: net/minecraft/server/AxisAlignedBB/e (DDD)Z net/minecraft/world/phys/AABB/contains (DDD)Z
OG code:
public final boolean contains(Vec3D vec3d) { return c(vec3d); } // Paper - OBFHELPER
public boolean c(Vec3D vec3d) {
return this.e(vec3d.x, vec3d.y, vec3d.z);
}
remapped (doesnt compile :/):
public final boolean contains(Vec3 vec3d) { return contains(vec3d); } // Paper - OBFHELPER
public boolean contains(Vec3 vec3d) {
return this.contains(vec3d.x, vec3d.y, vec3d.z);
}
Example:
//mc code
public abstract class Feature<FC extends FeatureConfig>{
public abstract boolean generate(IWorld world, ChunkGenerator<? extends ChunkGeneratorConfig> generator, Random random, BlockPos pos, FC config);
}
//my code
public class SimpleSpawnerFeature extends Feature<DefaultFeatureConfig>{
@Override
public boolean generate(
IWorld world,
ChunkGenerator<? extends ChunkGeneratorConfig> generator,
Random random,
BlockPos pos,
DefaultFeatureConfig config
){...}
}
In my code this "generate" cannot be remapped.
In AbstractClassMappingImpl#getMethodMapping, the input signature is MethodSignature{name=generate, descriptor=(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Ljava/util/Random;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/DefaultFeatureConfig;)Z}
And in this.methods it has MethodSignature{name=generate, descriptor=(Lnet/minecraft/world/IWorld;Lnet/minecraft/world/gen/chunk/ChunkGenerator;Ljava/util/Random;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/world/gen/feature/FeatureConfig;)Z}
So getMethodMapping will return null in this case.
Possible solution:
In AbstractClassMappingImpl#getMethodMapping, if it cannot find the method mapping that exactly match the signature, then find the method mapping that has the same name.
Attempting to remap CC: Restitched throws the following exception:
java.lang.RuntimeException: Failed to process: /home/squid/cc-restitched/src/main/java/dan200/computercraft/shared/network/NetworkMessage.java
at org.cadixdev.mercury.Mercury.accept(Mercury.java:237)
at org.cadixdev.mercury.Mercury$Requestor.acceptAST(Mercury.java:260)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1068)
at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:662)
at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1013)
at org.cadixdev.mercury.Mercury.run(Mercury.java:212)
at org.cadixdev.mercury.Mercury.rewrite(Mercury.java:167)
at net.fabricmc.loom.task.MigrateMappingsTask.migrateMappings(MigrateMappingsTask.java:189)
...
Caused by: java.lang.IllegalStateException: Unhandled binding: PackageBinding (1)
at org.cadixdev.mercury.remapper.RemapperVisitor.visit(RemapperVisitor.java:189)
at org.cadixdev.mercury.remapper.SimpleRemapperVisitor.visit(SimpleRemapperVisitor.java:183)
at org.eclipse.jdt.core.dom.SimpleName.accept0(SimpleName.java:198)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:162)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:162)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:162)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.QualifiedName.accept0(QualifiedName.java:162)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.TagElement.accept0(TagElement.java:317)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.Javadoc.accept0(Javadoc.java:194)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChild(ASTNode.java:2975)
at org.eclipse.jdt.core.dom.TypeDeclaration.accept0(TypeDeclaration.java:441)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.eclipse.jdt.core.dom.ASTNode.acceptChildren(ASTNode.java:2998)
at org.eclipse.jdt.core.dom.CompilationUnit.accept0(CompilationUnit.java:258)
at org.eclipse.jdt.core.dom.ASTNode.accept(ASTNode.java:2927)
at org.cadixdev.mercury.remapper.MercuryRemapper.rewrite(MercuryRemapper.java:54)
at org.cadixdev.mercury.SourceRewriter.process(SourceRewriter.java:20)
at org.cadixdev.mercury.SourceContext.process(SourceContext.java:82)
at org.cadixdev.mercury.RewriteContext.process(RewriteContext.java:106)
at org.cadixdev.mercury.Mercury.accept(Mercury.java:235)
... 136 more
Looking at the file in question, I believe this is caused by the @see
references to Java packages.
I assume a suitable bodge would be to just add a break;
after this comment (so it's skipped, rather than throwing an exception), but there may better solutions
Mercury/src/main/java/org/cadixdev/mercury/remapper/RemapperVisitor.java
Lines 190 to 192 in 409123d
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.