Code Monkey home page Code Monkey logo

specialsource's Introduction

Special Source

Automatic generator and renamer of jar obfuscation mappings.

specialsource's People

Contributors

abrarsyed avatar agaricusb avatar bigbade avatar bloodmc avatar humangamer avatar izzelaliz avatar kobata avatar lexmanos avatar lrns123 avatar lunnova avatar md-5 avatar mjaroslav avatar nekocaffeine avatar pisaiah avatar pokechu22 avatar qartemist avatar recursiveg avatar sizableshrimp avatar squiddev avatar su5ed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

specialsource's Issues

Filedates bugged in jars produced by gradle

All the jar files created by gradle build have their contained files and folders set to filedate 1980-01-01 0:00 modified and the created/accessed timestamps are completely missing (set to null?).
This makes it difficult to check when certain mods were released, as the downloaded jar's timestamp is set to the time of download, not the time of creation.

After closer inspection I've found the cause of the bug.
In net/md_5/specialsource/JarRemapper.java at line 212 there is entry.setTime(0);,
this line needs to be removed to fix the issue.

Error when run SpecialSource

When i run it by comman
java -jar SpecialSource.zip
it's say Error: Invalid or corrupt jarfile
How to fix it ?

How to use SpecialSource with Cauldron?

I read this tutorial and ported my plugin on Cauldron 1.7.10:
http://bukkit.org/threads/tutorial-advanced-how-to-develop-plugins-using-mcp-for-nms-via-asm-remapping.131060/

But my plugin doesn't work. I decompiled reobfuscated version and some classes/fields was reobfuscated, but not all. Then I run script for remap to CB and plugin deobfuscating instead of reobfuscate fully. bloodmc ported Citizens2 the same way, but I can't write him, he not reply.
My CB remap script: java -jar SpecialSource.jar --in-jar OnlyFlags-obf.jar --out-jar OnlyFlags_Cauldron.jar --srg-in obf2pkgmcp.srg --out-shade-relocation net.minecraft.server=net.minecraft.server.v1_7_R4,org.bouncycastle=net.minecraft.v1_7_R4.org.bouncycastle

SourceFile attribute is not remapped

When compiling against Spigot's Mojang-mapped jar, I was getting tons of warnings about auxiliary classes:

/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:27: warning: auxiliary class EntityArgument in ArgumentEntity.java should not be accessed from outside its own source file
import net.minecraft.commands.arguments.EntityArgument;
                                       ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:30: warning: auxiliary class Component in IChatBaseComponent.java should not be accessed from outside its own source file
import net.minecraft.network.chat.Component;
                                 ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:33: warning: auxiliary class ServerPlayer in EntityPlayer.java should not be accessed from outside its own source file
import net.minecraft.server.level.ServerPlayer;
                                 ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:42: warning: auxiliary class Commands in CommandDispatcher.java should not be accessed from outside its own source file
import static net.minecraft.commands.Commands.argument;
                                    ^
/home/runner/work/special-gradle/special-gradle/test-plugin/src/main/java/xyz/jpenilla/specialgradle/testplugin/TestPlugin.java:43: warning: auxiliary class Commands in CommandDispatcher.java should not be accessed from outside its own source file
import static net.minecraft.commands.Commands.literal;
                                    ^

... truncated, but there were many more similar warnings

Upon further inspection, I noticed that this is due to SpecialSource not remapping the SourceFile attribute at all.

This can bee seen by unzipping the Mojang-mapped Spigot jar from BuildTools, and running javap -v on any class file edited by Spigot or CraftBukkit, for example, ServerPlayer (EntityPlayer in Spigot names):

javap -v net/minecraft/server/level/ServerPlayer.class | grep SourceFile
  #3363 = Utf8               SourceFile
SourceFile: "EntityPlayer.java"

Dependencies with remapped source are unable to be depended on cleanly.

Take two plugins, A and B.

Both A and B depend on a mojang mapped spigot. B depends on A.

When building A and remapping, all is fine.

But when B depends on A, A's pom still uses the remapped NMS, but of course, since A's source now uses obfuscated NMS, it can't build properly. Using certain methods (which use NMS) from A leads to a build error for B, looking like: "Cannot access class:".

SpecialSource could:

  • Remap the pom too (Unsure if this is even possible) This isn't ideal as now you're working with two versions of NMS in your IDE when working on B, one of which is wrong.
  • Build a mojang mapped version also (Non-remapped, if you will) for any plugins that depend on it.
  • Something else I'm not aware of, it's a messy situation and I'm unsure.

Currently, I have to import the obfuscated nms as well, which leads back to: "This isn't ideal as now you're working with two versions of NMS in your IDE when working on B, one of which is wrong."

SS doesn't understand -f.

Caused by: java.lang.IllegalArgumentException: Invalid access visibility: -f at net.md_5.specialsource.AccessChange.<init>(AccessChange.java:107) at net.md_5.specialsource.AccessMap.addAccessChange(AccessMap.java:138) at net.md_5.specialsource.AccessMap.addAccessChange(AccessMap.java:134) at net.md_5.specialsource.AccessMap.loadAccessTransformer(AccessMap.java:83) at net.md_5.specialsource.AccessMap.loadAccessTransformer(AccessMap.java:88) at net.md_5.specialsource.AccessMap$loadAccessTransformer.call(Unknown Source)

-f aqw.cE

remapping overloaded field names (matching on field descriptor)

The JVM allows multiple fields to have the same name and owner but different descriptor:

http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.5

Each field is described by a field_info structure. No two fields in one class file may have the same name and descriptor (§4.3.2).

Currently SpecialSource only supports remapping fields by (owner, name) -> name, not (owner, name, desc) -> name. This normally suffices since Java source code cannot overload fields, but, obfuscation can introduce this unusual but valid bytecode. To deobfuscate properly, the field type descriptors are needed in the mappings (should be optional).

See also: MinecraftForge/FML#210

AT works with SS, but does not work in FML at runtime

This works with the AT loader in SS, but does not work in FML at runtime.
protected net.minecraft.entity.monster.EntityCreeper.field_70833_d #timeSinceIgnited

This is what FML loads, and this is how its supposed to be.
protected net.minecraft.entity.monster.EntityCreeper field_70833_d #timeSinceIgnited

The only difference is that the period between the className and the field/method name has been changed to a space.

Weird reobfuscation error with scala traits causes AbstractMethodError when running in obfuscated environment

This happens if a scala trait that doesn't extend a vanilla class declares a method with the same name as something in a vanilla class, then a class mixes this trait with that class, for example:

trait A {
  def getWorldObj: World
}

class B extends TileEntity with A

object C {
  def foo(p: A) = p.getWorldObj
  def bar(p: B) = p.getWorldObj
}

This compiles and works correctly in an unobfuscated environment.
After reobfuscation C.bar gets changed to the obfuscated name as expected

0: aload_1       
1: invokevirtual #30                 // Method test/B.func_145831_w:()Lnet/minecraft/world/World;
4: areturn       

But the interface and C.foo still refers to the unobfuscated name

0: aload_1       
1: invokeinterface #20,  1           // InterfaceMethod test/A.getWorldObj:()Lnet/minecraft/world/World;
6: areturn       

And a call to C.foo will crash with

java.lang.AbstractMethodError: test.B.getWorldObj()Lnet/minecraft/world/World;

I made a minimal project to demonstrate the issue - it will crash in PreInit when running in an obfuscated environment.

Same thing can also happen in java (though i guess it's less common to do something like that without mixins)

public interface A {
    World getWorldObj();
}

public class B extends TileEntity implements A {
}

public class C {
    static World foo(A p) {
        return p.getWorldObj();
    }

    static World foo(B p) {
        return p.getWorldObj();
    }
}

Gives exactly the same result.

I'm not even sure how this can be fixed, creating a synthetic bridge method during reobfuscation? Would that be possible or even be a good idea?

SS throws a ZipException

java.util.zip.ZipException: duplicate entry: net/minecraft/command/CommandExecuteAt$1.class
    at java.util.zip.ZipOutputStream.putNextEntry(ZipOutputStream.java:215)
    at java.util.jar.JarOutputStream.putNextEntry(JarOutputStream.java:109)
    at net.md_5.specialsource.JarRemapper.remapJar(JarRemapper.java:213)
    at net.md_5.specialsource.SpecialSource.main(SpecialSource.java:269)
    at net.pizzacrust.mcpinjector.Injector.main(Injector.java:179)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

no main class found

C:\Users\wolfg\Downloads\export mod>java -jar SpecialSource.jar
Error: Could not find or load main class net.md_5.specialsource.SpecialSource

Please fix

java.lang.NoClassDefFoundError: net/md_5/specialsource/transformer/MappingTransformer

Summary:

  • I have a plugin that works with SpecialSource 1.7.4 but not 1.7 SNAPSHOT
  • 1.7 SNAPSHOT works with my server but not with plugin
  • 1.7.4 works with plugin but crashes my server

I'm trying to get Luckperms to work with Cauldron 1.7.10 and the suggested solution was to use SpecialSource 1.7.4 instead of the 1.7 SNAPSHOT I was on.
CyberdyneCC/Thermos#498 (comment)
I tried using SpecialSource 1.7.4 but I got this error:
java.lang.NoClassDefFoundError: net/md_5/specialsource/transformer/MappingTransformer
Crash report: https://drive.google.com/open?id=0B_vrOlC_nFXlU21NVHBVY010TTg

Additional info on Luckperms: https://www.spigotmc.org/threads/luckperms-an-advanced-permissions-plugin.174259/page-56#post-2481259

NPC plugin

Hello, I have a problem creating a plugin for the NPC spawn. There are no errors in the code, especially since I took the code from ready-made plugins. But at the same time, when I try to spawn the NPC, it throws me a huge stack of errors, which I don’t know how they are related to my plugin:

[15:03:14 ERROR]: Packet encoding of packet ID 54 threw (skippable? false)
java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "string" is null
        at net.minecraft.network.FriendlyByteBuf.writeUtf(FriendlyByteBuf.java:550) ~[?:?]
        at net.minecraft.network.FriendlyByteBuf.writeUtf(FriendlyByteBuf.java:546) ~[?:?]
        at net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket$Action$1.write(ClientboundPlayerInfoPacket.java:91) ~[?:?]
        at net.minecraft.network.FriendlyByteBuf.writeCollection(FriendlyByteBuf.java:134) ~[?:?]
        at net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket.write(ClientboundPlayerInfoPacket.java:49) ~[?:?]
        at net.minecraft.network.PacketEncoder.encode(PacketEncoder.java:44) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.network.PacketEncoder.encode(PacketEncoder.java:15) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.network.Connection.a(Connection.java:315) ~[?:?]
        at net.minecraft.network.Connection.lambda$sendPacket$4(Connection.java:295) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[patched_1.17.jar:git-Paper-79]
        at java.lang.Thread.run(Thread.java:831) [?:?]
[15:03:14 ERROR]: Packet encoding of packet ID 54 threw (skippable? false)
java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "string" is null
        at net.minecraft.network.FriendlyByteBuf.writeUtf(FriendlyByteBuf.java:550) ~[?:?]
        at net.minecraft.network.FriendlyByteBuf.writeUtf(FriendlyByteBuf.java:546) ~[?:?]
        at net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket$Action$1.write(ClientboundPlayerInfoPacket.java:91) ~[?:?]
        at net.minecraft.network.FriendlyByteBuf.writeCollection(FriendlyByteBuf.java:134) ~[?:?]
        at net.minecraft.network.protocol.game.ClientboundPlayerInfoPacket.write(ClientboundPlayerInfoPacket.java:49) ~[?:?]
        at net.minecraft.network.PacketEncoder.encode(PacketEncoder.java:44) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.network.PacketEncoder.encode(PacketEncoder.java:15) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.handler.codec.MessageToByteEncoder.write(MessageToByteEncoder.java:107) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWrite0(AbstractChannelHandlerContext.java:717) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.invokeWriteAndFlush(AbstractChannelHandlerContext.java:764) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.write(AbstractChannelHandlerContext.java:790) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:758) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannelHandlerContext.writeAndFlush(AbstractChannelHandlerContext.java:808) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.DefaultChannelPipeline.writeAndFlush(DefaultChannelPipeline.java:1025) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.AbstractChannel.writeAndFlush(AbstractChannel.java:306) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.network.Connection.a(Connection.java:315) ~[?:?]
        at net.minecraft.network.Connection.lambda$sendPacket$4(Connection.java:295) ~[?:?]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:500) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989) ~[patched_1.17.jar:git-Paper-79]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[patched_1.17.jar:git-Paper-79]
        at java.lang.Thread.run(Thread.java:831) [?:?]
[15:03:14 INFO]: null lost connection: Internal Exception: io.netty.handler.codec.EncoderException: java.lang.NullPointerException: Cannot invoke "String.getBytes(java.nio.charset.Charset)" because "string" is null
[15:03:14 ERROR]: Encountered an unexpected exception
java.lang.NullPointerException: Cannot invoke "String.isEmpty()" because "content" is null
        at net.kyori.adventure.text.Component.text(Component.java:646) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.players.PlayerList.disconnect(PlayerList.java:598) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.network.ServerGamePacketListenerImpl.onDisconnect(ServerGamePacketListenerImpl.java:1890) ~[?:?]
        at net.minecraft.network.Connection.handleDisconnection(Connection.java:564) ~[?:?]
        at net.minecraft.server.network.ServerConnectionListener.tick(ServerConnectionListener.java:216) ~[?:?]
        at net.minecraft.server.MinecraftServer.tickChildren(MinecraftServer.java:1576) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.dedicated.DedicatedServer.tickChildren(DedicatedServer.java:477) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.MinecraftServer.tickServer(MinecraftServer.java:1404) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1180) ~[patched_1.17.jar:git-Paper-79]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[patched_1.17.jar:git-Paper-79]
        at java.lang.Thread.run(Thread.java:831) [?:?]

Here is my code:

public class NPC extends ServerPlayer {

    public NPC(MinecraftServer server, ServerLevel world, GameProfile profile, Location loc) {
        super(server, world, profile);
        this.setPos(loc.getX(), loc.getY(), loc.getZ());
        this.setRot(loc.getYaw(), loc.getPitch());
    }

    @Override
    public boolean isCreative() {
        return false;
    }

    @Override
    public boolean isSpectator() {
        return false;
    }

}

And then just:

GameProfile profile = new GameProfile(UUID.randomUUID(), "Man");
profile.getProperties().put("textures", new Property("textures", type.value, type.signature));
MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
ServerLevel world = ((CraftWorld) loc.getWorld()).getHandle();

NPC npc = new NPC(server, world, profile, loc);
Entity entity = npc.getBukkitEntity();
entity.setGravity(false);

can anyone help me?

'gradle build' failed at ':reobf'

It says 'MALFORMED'. How it comes?

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':reobf'.

    MALFORMED

  • Try:
    Run with --info or --debug option to get more log output.

  • Exception is:
    org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':reobf'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:305)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:29)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:80)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:33)
    at org.gradle.launcher.cli.ExecuteBuildAction.run(ExecuteBuildAction.java:24)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:36)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:26)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:51)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:171)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    Caused by: java.lang.IllegalArgumentException: MALFORMED
    at net.md_5.specialsource.Jar.collectJarFiles(Jar.java:177)
    at net.md_5.specialsource.Jar.init(Jar.java:237)
    at net.md_5.specialsource.Jar.init(Jar.java:214)
    at net.minecraftforge.gradle.tasks.user.reobf.ObfArtifact.applySpecialSource(ObfArtifact.java:369)
    at net.minecraftforge.gradle.tasks.user.reobf.ObfArtifact.generate(ObfArtifact.java:348)
    at net.minecraftforge.gradle.tasks.user.reobf.ReobfTask.doTask(ReobfTask.java:298)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:63)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:218)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:211)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:200)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:579)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:562)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 44 more

Inner classes are not actually renamed

It updates the file name and references, but the original class name is still in the bytecode, which is what decompilers are using to name the class. This has become an issue with Minecraft 1.8.3 since inner classes and other attributes were kept.

This is what is in the relevant bytecode in both the owner's class and the class in question, the first name after INNERCLASS being the file name, second is the owner, third is the actual class name. Test.Original was renamed to Test.Renamed.

  // access flags 0x4019
  public final static enum INNERCLASS Test$Renamed Test Original

Using an example from Minecraft 1.8.3:

  // access flags 0x4019
  public final static enum INNERCLASS net/minecraft/util/Util$OS net/minecraft/util/Util a

For the Util class, I used these srg lines.

CL: h$a net/minecraft/util/Util$OS
CL: h net/minecraft/util/Util

`FluidState` gets remapped by mistake when running maven `build`

Hello!
Seems somehow this Level#getFluidState function calls are not getting remapped correctly, its return type has a wrong remapped name.
java.lang.NoSuchMethodError: 'net.minecraft.world.level.material.FluidType net.minecraft.world.level.World.b_(net.minecraft.core.BlockPosition)'

It should be Fluid instead of FluidType, as I can see by decompiling the Spigot jar.
public Fluid b_(BlockPosition pos).

Is this normal? Am I missing something?
Fluid and FluidType are two different classes in the remapped Spigot jar, this is weird.

Thanks a lot for the help.

Records aren't mapped properly

Classes that extend Record, implementing synthetic toString, hashCode, and/or equals, with the characteristic of this.method<invokedynamic>(...) under fernflower, require special mapping treatment to be used in a debug environment without remapping.

Assembly:

DEFINE PUBLIC FINAL hashCode()I
A:
LINE A 54
ALOAD this
INVOKEDYNAMIC hashCode (Lnet/minecraft/world/level/biome/BiomeSource$1FeatureData;)I handle[H_INVOKESTATIC java/lang/runtime/ObjectMethods.bootstrap(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/TypeDescriptor;Ljava/lang/Class;Ljava/lang/String;[Ljava/lang/invoke/MethodHandle;)Ljava/lang/Object;] args[Lnet/minecraft/world/level/biome/BiomeSource$1FeatureData;, "step;feature", handle[H_GETFIELD net/minecraft/world/level/biome/BiomeSource$1FeatureData.a I], handle[H_GETFIELD net/minecraft/world/level/biome/BiomeSource$1FeatureData.b Lnet/minecraft/world/level/levelgen/feature/ConfiguredFeature;]]
IRETURN
B:
C:

CFR:

package net.minecraft.world.level.biome;

import java.lang.invoke.MethodHandle;
import java.lang.runtime.ObjectMethods;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;

record BiomeSource$1FeatureData(int step, ConfiguredFeature<?, ?> feature) {
    @Override
    public final String toString() {
        return ObjectMethods.bootstrap("toString", new MethodHandle[]{BiomeSource$1FeatureData.class, "step;feature", "a", "b"}, this);
    }

    @Override
    public final int hashCode() {
        return (int)ObjectMethods.bootstrap("hashCode", new MethodHandle[]{BiomeSource$1FeatureData.class, "step;feature", "a", "b"}, this);
    }

    @Override
    public final boolean equals(Object object) {
        return (boolean)ObjectMethods.bootstrap("equals", new MethodHandle[]{BiomeSource$1FeatureData.class, "step;feature", "a", "b"}, this, object);
    }
}

With a gradle multiproject, SS may be illegally altering a zip and crashing on Linux

I have a gradle multproject, Binnie's mods.
A Linux build server is set up to automatically build the combined mod jar.
The build crashes at "reobf" every time, and the gradle daemon quits with no error message. Travis log.

This turned out to be caused by a JDK crash which I reported and hope to hear back on.

@cpw was able to reproduce the issue on his Linux machine, and believes the JDK crash is caused by some part of the build process reading a zip file while another is editing it.
This only crashes on Linux because Windows locks the file and Linux does not.

We suspect SpecialSource is involved, if not I still hope to get your thoughts on this.

Wiki Request

Please create a wiki to help people use this tools

Fields that shadow remappable fields get inadvertently remapped when referred to from a subclass

Sry for the mouthful of a title, this is a pretty specific issue, also i produced this from inside ForgeGradle 3 and 5 and have been sent here MinecraftForge/ForgeGradle#821 !
gonna put the original issue text below Okay


forgegradle-based test case is at https://github.com/quat1024/bugtest if you wanna try it

Easiest to explain by example, so here's the scene:

public abstract class Superclass extends DirectionalBlock {
  public Superclass(Properties props) {
    super(props);
    
    registerDefaultState(defaultBlockState()
      .setValue(FACING, Direction.UP)
      .setValue(POWERED, false));
  }

  public static final EnumProperty<Direction> FACING = DirectionalBlock.FACING; //shadows a field from superclass (!)
  public static final BooleanProperty POWERED = BlockStateProperties.POWERED; //for comparison's sake
  
  @Override
  protected void createBlockStateDefinition(StateContainer.Builder<Block, BlockState> builder) {
    builder.add(FACING, POWERED);
  }
}

//...

public class Subclass extends Superclass {
  public Subclass(Properties props) {
    super(props);
  }
  
  @Nullable
  @Override
  public BlockState getStateForPlacement(BlockItemUseContext ctx) {
    return defaultBlockState()
      .setValue(FACING, ctx.getClickedFace().getOpposite())
      .setValue(POWERED, false);
  }
}

The important parts:

  • Superclass extends Minecraft's DirectionalBlock, and both classes have a field named FACING. Mine shadows theirs.
  • References to DirectionalBlock.FACING should be remapped to DirectionalBlock.field_176387_N, but references to Superclass.FACING should stay the same.
  • Subclass refers to that field.

I built a reobf jar using ForgeGradle's standard build task. One of its subtasks remaps the mod to SRG names using SpecialSource, and here's what i found:

  • Superclass correctly contains two fields named FACING and POWERED,
  • Superclass#createBlockStateDefinition correctly refers to the fields named FACING and POWERED,
  • Subclass#getStateForPlacement incorrectly refers to fields named field_176387_N and POWERED instead.

This fails at runtime with a NoSuchFieldError, see quat1024/incorporeal-2-forge#11.

👀 Only accesses from subclasses are incorrectly remapped. Referring to the public static field Superclass.FACING from an unrelated class uses the correct name of FACING

SpecialSource reorders local variables, unlike RetroGuard (blocking MCP adaption)

SpecialSource's use of ASM rewrites the constant pool therefore reordering local variables causing patch discrepancies when compared to RetroGuard.

Example comparing SpecialSource to RetroGuard (as used in MCP):

diff -ur src/minecraft/net/minecraft/server/MinecraftServer.java src-/minecraft/net/minecraft/server/MinecraftServer.java
--- src/minecraft/net/minecraft/server/MinecraftServer.java     2013-03-10 18:51:56.000000000 -0700
+++ src-/minecraft/net/minecraft/server/MinecraftServer.java    2013-03-10 18:50:08.000000000 -0700
@@ -137,17 +137,17 @@ (near "menu.loadingLevel")
       this.field_71305_c = new WorldServer[3];
       this.field_71312_k = new long[this.field_71305_c.length][100];
       ISaveHandler var7 = this.field_71310_m.func_75804_a(p_71247_1_, true);
-      WorldInfo var9 = var7.func_75757_d();
-      WorldSettings var8;
-      if(var9 == null) {
-         var8 = new WorldSettings(p_71247_3_, this.func_71265_f(), this.func_71225_e(), this.func_71199_h(), p_71247_5_);
-         var8.func_82750_a(p_71247_6_);
+      WorldInfo var8 = var7.func_75757_d();
+      WorldSettings var9;
+      if(var8 == null) {
+         var9 = new WorldSettings(p_71247_3_, this.func_71265_f(), this.func_71225_e(), this.func_71199_h(), p_71247_5_);
+         var9.func_82750_a(p_71247_6_);
       } else {
-         var8 = new WorldSettings(var9);
+         var9 = new WorldSettings(var8);
       }

more at https://gist.github.com/agaricusb/5131683 - but this difference is pervasive throughout the decompile

The vanilla (unremapped) code is as follows:

  ajz var7 = this.l.a(var1, true);
  ajp var9 = var7.d();
  aac var8;

7, 9, 8 is vanilla/RG but SS reorders to 7, 8, 9.

vanilla disassembly with javap:

     6: ldc           #55                 // String menu.loadingLevel
     8: invokevirtual #335                // Method c:(Ljava/lang/String;)V
    11: aload_0       
    12: iconst_3      
    13: anewarray     #112                // class iz
    16: putfield      #185                // Field b:[Liz;
    19: aload_0       
    20: aload_0       
    21: getfield      #185                // Field b:[Liz;
    24: arraylength   
    25: bipush        100
    27: multianewarray #80,  2            // class "[[J"
    31: putfield      #193                // Field j:[[J
    34: aload_0       
    35: getfield      #195                // Field l:Lakc;
    38: aload_1       
    39: iconst_1      
    40: invokeinterface #366,  3          // InterfaceMethod akc.a:(Ljava/lang/String;Z)Lajz;
    45: astore        7
    47: aload         7
    49: invokeinterface #363,  1          // InterfaceMethod ajz.d:()Lajp;
    54: astore        9
    56: aload         9
    58: ifnonnull     96
    61: new           #82                 // class aac

RetroGuard:

     6: ldc           #55                 // String menu.loadingLevel
     8: invokevirtual #335                // Method func_71192_d:(Ljava/lang/String;)V
    11: aload_0       
    12: iconst_3      
    13: anewarray     #112                // class net/minecraft/src/WorldServer
    16: putfield      #185                // Field field_71305_c:[Lnet/minecraft/src/WorldServer;
    19: aload_0       
    20: aload_0       
    21: getfield      #185                // Field field_71305_c:[Lnet/minecraft/src/WorldServer;
    24: arraylength   
    25: bipush        100
    27: multianewarray #80,  2            // class "[[J"
    31: putfield      #193                // Field field_71312_k:[[J
    34: aload_0       
    35: getfield      #195                // Field field_71310_m:Lnet/minecraft/src/ISaveFormat;
    38: aload_1       
    39: iconst_1      
    40: invokeinterface #366,  3          // InterfaceMethod net/minecraft/src/ISaveFormat.func_75804_a:(Ljava/lang/String;Z)Lnet/minecraft/src/ISaveHandler;
    45: astore        7
    47: aload         7
    49: invokeinterface #363,  1          // InterfaceMethod net/minecraft/src/ISaveHandler.func_75757_d:()Lnet/minecraft/src/WorldInfo;
    54: astore        9
    56: aload         9
    58: ifnonnull     96
    61: new           #82                 // class net/minecraft/src/WorldSettings

SS:

     6: ldc           #192                // String menu.loadingLevel
     8: invokevirtual #173                // Method func_71192_d:(Ljava/lang/String;)V
    11: aload_0       
    12: iconst_3      
    13: anewarray     #194                // class net/minecraft/src/WorldServer
    16: putfield      #196                // Field field_71305_c:[Lnet/minecraft/src/WorldServer;
    19: aload_0       
    20: aload_0       
    21: getfield      #196                // Field field_71305_c:[Lnet/minecraft/src/WorldServer;
    24: arraylength   
    25: bipush        100
    27: multianewarray #197,  2           // class "[[J"
    31: putfield      #199                // Field field_71312_k:[[J
    34: aload_0       
    35: getfield      #135                // Field field_71310_m:Lnet/minecraft/src/ISaveFormat;
    38: aload_1       
    39: iconst_1      
    40: invokeinterface #203,  3          // InterfaceMethod net/minecraft/src/ISaveFormat.func_75804_a:(Ljava/lang/String;Z)Lnet/minecraft/src/ISaveHandler;
    45: astore        7
    47: aload         7
    49: invokeinterface #209,  1          // InterfaceMethod net/minecraft/src/ISaveHandler.func_75757_d:()Lnet/minecraft/src/WorldInfo;
    54: astore        8
    56: aload         8
    58: ifnonnull     96
    61: new           #211                // class net/minecraft/src/WorldSettings

All of the constant references are shifted, but only local variables create a discrepancy for fernflower decompilation.

edit: actually its the local variable slots - astore 8 vs astore 9 on line 54

[Request] do work on folder instead of archive file

I haven't figured it out if it can already do this:
I'd love to see this be able to work through a directory, which basically has the contents of an unpacked jar. This would help me streamline some automation i have planned around this tool.

Issue when reobfuscating lambda methods

(Originally opened as MinecraftForge/ForgeGradle#716)

Using minecraft 1.16.2 with ForgeGradle 3

I've recently started using official names. However, there appears to be an issue somewhere in the reobf process when building a jar.
This line causes issues: https://github.com/ichttt/SoundDeviceOptions/blob/8a6e49b8e6e9e1337585d23bc2453db5a6d2006b/src/main/java/ichttt/mods/sounddeviceoptions/client/gui/GuiSound.java#L47 as it compiled to the following (decompiled code using CFR of the reobfed jar):

        this.func_230480_a_((Widget)new Button(this.field_230708_k_ / 2 - 100, this.field_230709_l_ / 6 + 156, 200, 20, (ITextComponent)new TranslationTextComponent("sounddeviceoptions.output", new Object[]{SDOConfig.friendlyActiveSoundDevice()}), (Button.IPressable)LambdaMetafactory.metafactory(null, null, null, (Lnet/minecraft/client/gui/widget/button/Button;)V, func_213105_b(net.minecraft.client.gui.widget.button.Button ), (Lnet/minecraft/client/gui/widget/button/Button;)V)((GuiSound)this)));

Notice that the Metafactory references the func_213105_b method, which is a private synthetic lambda method of the super class (OptionsSoundsScreen), instead of the lambda$init$0 method, which is the correct private synthetic lamda method of my GuiSound class.
This causes the following stacktrace when running the game from the launcher:

java.lang.IllegalAccessError: tried to access method net.minecraft.client.gui.screen.OptionsSoundsScreen.func_213105_b(Lnet/minecraft/client/gui/widget/button/Button;)V from class ichttt.mods.sounddeviceoptions.client.gui.GuiSound
	at java.lang.invoke.MethodHandleNatives.resolve(Native Method) ~[?:1.8.0_51] {}
	at java.lang.invoke.MemberName$Factory.resolve(MemberName.java:962) ~[?:1.8.0_51] {}
	at java.lang.invoke.MemberName$Factory.resolveOrFail(MemberName.java:987) ~[?:1.8.0_51] {}
	at java.lang.invoke.MethodHandles$Lookup.resolveOrFail(MethodHandles.java:1390) ~[?:1.8.0_51] {}
	at java.lang.invoke.MethodHandles$Lookup.linkMethodHandleConstant(MethodHandles.java:1746) ~[?:1.8.0_51] {}
	at java.lang.invoke.MethodHandleNatives.linkMethodHandleConstant(MethodHandleNatives.java:477) ~[?:1.8.0_51] {}
	at ichttt.mods.sounddeviceoptions.client.gui.GuiSound.func_231160_c_(GuiSound.java:47) ~[?:1.4.1] {re:classloading}
	at net.minecraft.client.gui.screen.Screen.func_231158_b_(Screen.java:323) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.client.Minecraft.func_147108_a(Minecraft.java:829) ~[?:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A}

Here are the classes (from the jar after reobf and when compiling using javac): Classes.zip
You should be able to reproduce the issue by forking https://github.com/ichttt/SoundDeviceOptions and running gradlew build

zip END header not found

This is my plugin configuration on my pom.xml.
Sometimes this exception is produced on compiling my plugin.
My guess is that the "remapped-obf" jar has not been fully saved when the next goal is already trying to access it. As I said, it only happens sometimes, seemingly randomly. When it does work, the compiling is performed succesfully and the plugin works normally.

SpecialSource doesn't remap fields properly

Mapped Code:

public class Test {
     private Test test = new Test();
}

Reversed Mapped Code:

public class RemappedTest {
  private RemappedTest test = new RemappedTest();
}

It should be:

public class RemappedTest {
  private RemappedTest a = new RemappedTest();
}

This is what is happening to me right now.

Doesnt work with java 17

java.lang.IllegalArgumentException: Unsupported class file major version 61
	at org.objectweb.asm.ClassReader.<init>(ClassReader.java:196)
	at org.objectweb.asm.ClassReader.<init>(ClassReader.java:177)
	at org.objectweb.asm.ClassReader.<init>(ClassReader.java:163)
	at org.objectweb.asm.ClassReader.<init>(ClassReader.java:284)
	at net.md_5.specialsource.JarRemapper.remapClassFile(JarRemapper.java:268)
	at net.md_5.specialsource.JarRemapper.remapJar(JarRemapper.java:205)
	at net.md_5.specialsource.JarRemapper.remapJar(JarRemapper.java:178)
	at net.md_5.specialsource.mavenplugin.RemapMojo.execute(RemapMojo.java:214)
	at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
	at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
	at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
	at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
	at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
	at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
	at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
	at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
	at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
	at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:577)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
	at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
	at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
	at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
	at org.codehaus.classworlds.Launcher.main(Launcher.java:47)

Java details:
openjdk 17.0.4 2022-07-19
OpenJDK Runtime Environment (build 17.0.4+8)
OpenJDK 64-Bit Server VM (build 17.0.4+8, mixed mode)

pom.xml

   <build>
        <defaultGoal>package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <release>17</release>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.md-5</groupId>
                <artifactId>specialsource-maven-plugin</artifactId>
                <version>1.2.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-obf</id>
                        <configuration>
                            <srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:txt:maps-mojang</srgIn>
                            <reverse>true</reverse>
                            <remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-mojang</remappedDependencies>
                            <remappedArtifactAttached>true</remappedArtifactAttached>
                            <remappedClassifierName>remapped-obf</remappedClassifierName>
                        </configuration>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>remap</goal>
                        </goals>
                        <id>remap-spigot</id>
                        <configuration>
                            <inputFile>${project.build.directory}/${project.artifactId}-${project.version}-remapped-obf.jar</inputFile>
                            <srgIn>org.spigotmc:minecraft-server:1.18.1-R0.1-SNAPSHOT:csrg:maps-spigot</srgIn>
                            <remappedDependencies>org.spigotmc:spigot:1.18.1-R0.1-SNAPSHOT:jar:remapped-obf</remappedDependencies>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.18.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.18.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
    </dependencies>```

class which extend other classes, their methods are not remapped

im trying to reobfuscate a minecraft mod, and i have the srg file all setup, and this is my code:

player.setSprinting(true)

the setSprinting function is found in the class LivingEntity. but the player variable is an EntityPlayer which is in a different package, but it extends LivingEntity (so, public class EntityPlayer extends LivingEntity). and as a result, the setSprinting method never gets remapped, even when using the --reverse parameter when remapping. the only fix i've found, is to manually edit the .srg file, and change the method location from LivingEntity to EntityPlayer (and also change the obfuscated class and method names too), but that would break other things too...

i've heard another fix is to deliberately cast the EntityPlayer method to LivingEntity (in my case atleast), so the code would look like this: ((LivingEntity) player).setSprinting(true). i haven't tried that, but i assume it does work. but i dont really want to have to do that for every line of code. or maybe there's an option in the compiler to make it do this? im not sure

is this fixable? or do i just have to do the above; manually cast the derived class to the base classes

RemappingClassAdapter remaps fields twice

RemappingClassAdapter was partially broken in this commit: e9311dc

It now remaps fields twice.

visitField maps the field then calls super.visitField. super.visitField maps the field again.

Here's an example field which broke in real usage, getting mapped from a -> x -> guiResponder instead of just a->x.

net/minecraft/client/gui/GuiTextField.x
Name: a => field_146209_f => x
net/minecraft/client/gui/GuiTextField.guiResponder
Name: x => field_175210_x => guiResponder

corrupted files ?

Hi, i own a famous brazilian modded server and idk why I cant open my minecraft server anymore, i believe that some file got corrupted, can you help me??

this is the crsah

Time: 4/2/21 11:23 PM
Description: Exception in server tick loop

java.lang.NoClassDefFoundError: net/md_5/specialsource/transformer/MavenShade
at org.bukkit.craftbukkit.v1_7_R4.SpigotTimings.(SpigotTimings.java:43)
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.(CraftTask.java:50)
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.(CraftTask.java:54)
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.(CraftTask.java:29)
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.(CraftScheduler.java:51)
at org.bukkit.craftbukkit.v1_7_R4.CraftServer.(CraftServer.java:151)
at net.minecraft.server.management.ServerConfigurationManager.(ServerConfigurationManager.java:130)
at net.minecraft.server.dedicated.DedicatedPlayerList.(SourceFile:14)
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:235)
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:643)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.ClassNotFoundException: net.md_5.specialsource.transformer.MavenShade
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 11 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 66
at org.objectweb.asm.ClassReader.a(Unknown Source)
at org.objectweb.asm.ClassReader.readUTF8(Unknown Source)
at org.objectweb.asm.ClassReader.readClass(Unknown Source)
at org.objectweb.asm.ClassReader.a(Unknown Source)
at org.objectweb.asm.ClassReader.b(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at cpw.mods.fml.common.asm.transformers.SideTransformer.transform(SideTransformer.java:43)
at net.minecraft.launchwrapper.LaunchClassLoader.runTransformers(LaunchClassLoader.java:279)
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:176)
... 13 more

SS doesn't remap methods implemented in a lambda

This problem has come up as more and more mods are moving to Java 8. SpecialSource appears to not fully remap the method names of interfaces and abstract classes when they are implemented using a lambda.

Test class:

public class Test {
    public static void main(String[] args) {
        Foo f = () -> "Matthew";

        System.out.println(f.getName());
    }

    private interface Foo {
        String getName();
    }
}

SRG line:

MD: Test$Foo/getName ()Ljava/lang/String; Test$Foo/getFoo ()Ljava/lang/String;

Error:

Exception in thread "main" java.lang.AbstractMethodError: Test$$Lambda$1/791452441.getFoo()Ljava/lang/String;
    at Test.main(Test.java:5)

Source: MinecraftForge/ForgeGradle#336

Class names are mapped twice when loading tsrg reversed

Mapped once here:

if (reverse) {
classes.put(newClassName, oldClassName);
currentClass = tokens[1];
} else {

and again here:
if (reverse) {
String newClassName = reverseMap.map(oldClassName);
if (newClassName.equals(oldClassName)) {
// throw new IOException("Invalid csrg file line, could not be reversed: " + line);
}

If there is a mapping(tsrg) that:

pkg/b pkg/c
pkg/a pkg/b
  obf ()V src

loading with reverse=true results in pkg/c/src ()V -> obf which is incorrect

Special Source Source Level 7 Suport

Special Source is unable to support source level 7, producing errors after building projects at runtime like these.
While -noverify is a temporary fix, the full reason as to why it is happening is explained on StackOverflow here.

I believe Special Source is at fault, but I am not sure. If it is, is it possible to implement what is mentioned in the StackOverflow post?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.