Page MenuHomeFeedback Tracker

Modding static methods
New, UrgentPublic

Description

If you try to mod a static method you will end up with a unwanted behaviour of the code.
If the modded method is called from another class it will call the overwritten method, but if it is called from the original class the original method is called.
In addition to that you can't call the original Method from the modded one, because super is not available on static methods and otherwise you would end up with a stack overflow

Details

Severity
Tweak
Resolution
Open
Reproducibility
Always
Operating System
Windows 10 x64
Category
General
Steps To Reproduce

class TestClassLB {
static void TestMethod() {

		TestMethod2();

}
static void TestMethod2() {

		Print("Original TestMethod");

}
}
modded class TestClassLB {
static void TestMethod2() {

		Print("Modded TestMethod");

}
}
calling "TestClassLB.TestMethod()" will not output "Modded TestMethod" as you would expect, but will output "Original TestMethod"
but calling it directly with "TestClassLB.TestMethod2()" will output "Modded TestMethod" as expected.

it would be great to have a way to call the original method from the modded one with some kind of "SUPER.TestMethod2()" and make the original method invoke the modded one instead of the original one, like it's done everywhere else too

Event Timeline

rVn claimed this task.Jun 26 2019, 3:47 PM