skript-reflect icon indicating copy to clipboard operation
skript-reflect copied to clipboard

corrected static and non-static accessors

Open Vulcano771 opened this issue 8 months ago • 3 comments

This PR fixes ExprJavaCall.java's getters for methods.

If you for example have this code:

public class Test {

	private final boolean isActive;

	public Test() {
		isActive = true;
	}

	public boolean isActive() {
		return isActive;
	}

	public static boolean isActive(Test instance) {
		return instance.isActive();
	}

}

As Java compiles isActive() down to isActive(Test this) it falseley takes the instance method isActive instead of the correct method isActive(...).

Here's a small test:

on load:
	set {_s} to Test.isActive(new Test())

	set {_b} to new Test()

	broadcast "-> %{_s}%"
	broadcast "-> %{_b}.isActive()%"

Vulcano771 avatar Aug 31 '25 17:08 Vulcano771

Would be nice if someone could look over it If you have better ideas how to fix this feel free to contribute

Vulcano771 avatar Sep 02 '25 11:09 Vulcano771

Okay, what now?

Vulcano771 avatar Sep 03 '25 10:09 Vulcano771

Wait for another review or when we want to do a release

sovdeeth avatar Sep 03 '25 15:09 sovdeeth