McModLauncher / modlauncher

Java 21 mod launcher
Other
171 stars 47 forks source link

Only push to the audit trail if a launch plugin signals that it transformed a class #29

Closed ichttt closed 5 years ago

ichttt commented 5 years ago

Removes plugins from the log that read the class, but returned false (=no change) on processClass. I could not figure out how to make this nice with a stream, so I used a simple foreach loop.

Example forge stacktrace without this change

java.lang.RuntimeException: Test
    at net.minecraftforge.fml.common.gameevent.TickEvent.<init>(TickEvent.java:46) ~[classes/:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A}
    at net.minecraftforge.fml.common.gameevent.TickEvent$ClientTickEvent.<init>(TickEvent.java:59) ~[classes/:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A}
    at net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(BasicEventHooks.java:104) ~[classes/:?] {pl:eventbus:A,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1125) ~[classes/:?] {pl:accesstransformer:B,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:773) ~[classes/:?] {pl:accesstransformer:B,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:359) ~[classes/:?] {pl:accesstransformer:B,pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:117) ~[classes/:?] {pl:object_holder_definalize:A,pl:runtime_enum_extender:A,pl:capability_inject_definalize:A,pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201] {}
    at net.minecraftforge.userdev.FMLDevClientLaunchProvider.lambda$launchService$0(FMLDevClientLaunchProvider.java:84) ~[classes/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.1.1.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.1.1.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.1.1.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.1.1.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.1.1.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [classes/:?] {}

Example forge stacktrace with this change:

java.lang.RuntimeException: Test
    at net.minecraftforge.fml.common.gameevent.TickEvent.<init>(TickEvent.java:46) ~[classes/:?] {pl:eventbus:A}
    at net.minecraftforge.fml.common.gameevent.TickEvent$ClientTickEvent.<init>(TickEvent.java:59) ~[classes/:?] {pl:eventbus:A}
    at net.minecraftforge.fml.hooks.BasicEventHooks.onPreClientTick(BasicEventHooks.java:104) ~[classes/:?] {}
    at net.minecraft.client.Minecraft.runTick(Minecraft.java:1125) ~[classes/:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:773) ~[classes/:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.Minecraft.run(Minecraft.java:359) ~[classes/:?] {pl:accesstransformer:B,pl:runtimedistcleaner:A}
    at net.minecraft.client.main.Main.main(Main.java:117) ~[classes/:?] {pl:runtimedistcleaner:A}
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_201] {}
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_201] {}
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_201] {}
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_201] {}
    at net.minecraftforge.userdev.FMLDevClientLaunchProvider.lambda$launchService$0(FMLDevClientLaunchProvider.java:84) ~[classes/:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:19) [modlauncher-2.2.0-milestone.0.0+20190608T153435Z.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:32) [modlauncher-2.2.0-milestone.0.0+20190608T153435Z.jar:?] {}
    at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:50) [modlauncher-2.2.0-milestone.0.0+20190608T153435Z.jar:?] {}
    at cpw.mods.modlauncher.Launcher.run(Launcher.java:59) [modlauncher-2.2.0-milestone.0.0+20190608T153435Z.jar:?] {}
    at cpw.mods.modlauncher.Launcher.main(Launcher.java:44) [modlauncher-2.2.0-milestone.0.0+20190608T153435Z.jar:?] {}
    at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:98) [classes/:?] {}
cpw commented 5 years ago

:nauseated_face:

LexManos commented 5 years ago

Yes, but the spam is also horrid. If there was a way to have a tracked ClassNode... that would be best.

tterrag1098 commented 5 years ago

Honestly the old code is worse. peek is a debug method and isn't even guaranteed to be called.