ProbeJS

ProbeJS

972k Downloads

method filtering for parameterized interfaces seems not working at all

ZZZank opened this issue · 3 comments

commented

This issue is about hasIdenticalParentMethod method in ClassInfo.java , it sems not working at all for parameterized interfaces.

E.g. Internal.RecipeFilter, which is a subclass of Internal.Predicate<Internal.RecipeKJS>, and here is what looks like in an actual dump (using ProbeJS 5.3.4 for MC1.19):

    interface RecipeFilter extends Internal.Predicate<Internal.RecipeKJS> {
        test(arg0: any): boolean;
        negate(): Internal.Predicate<Internal.RecipeKJS>;
        not<T>(arg0: Internal.Predicate_<T>): Internal.Predicate<T>;
        or(arg0: Internal.Predicate_<Internal.RecipeKJS>): Internal.Predicate<Internal.RecipeKJS>;
        and(arg0: Internal.Predicate_<Internal.RecipeKJS>): Internal.Predicate<Internal.RecipeKJS>;
        test(arg0: Internal.RecipeKJS_): boolean;
        of(cx: Internal.Context_, o: any): this;
        isEqual<T>(arg0: any): Internal.Predicate<T>;
        readonly PARSE: dev.architectury.event.Event<Internal.RecipeFilterParseEvent>;
    }

and Internal.Predicate

    interface Predicate <T> {
        negate(): this;
        not<T>(arg0: Internal.Predicate_<T>): this;
        or(arg0: Internal.Predicate_<T>): this;
        test(arg0: T): boolean;
        and(arg0: Internal.Predicate_<T>): this;
        isEqual<T>(arg0: any): this;
        (arg0: T): boolean;
    }

It's clear that inherited methods are not being filtered out.

commented

/**
* 天生万物以养民,民无一善可报天。
* 不知蝗蠹遍天下,苦尽苍生尽王臣。
* 人之生矣有贵贱,贵人长为天恩眷。
* 人生富贵总由天,草民之穷由天谴。
* 忽有狂徒夜磨刀,帝星飘摇荧惑高。
* 翻天覆地从今始,杀人何须惜手劳。
* 不忠之人曰可杀!不孝之人曰可杀!
* 不仁之人曰可杀!不义之人曰可杀!
* 不礼不智不信人,大西王曰杀杀杀!
* 我生不为逐鹿来,都门懒筑黄金台,
* 状元百官都如狗,总是刀下觳觫材。
* 传令麾下四王子,破城不须封刀匕。
* 山头代天树此碑,逆天之人立死跪亦死!
*/

/**
* 我一直看着你👁👁
* 当你在寂静的深夜独自行走👁👁
* 感觉到背后幽幽的目光直流冷汗👁👁
* 转头却空空荡荡时👁👁
* 那是我在看着你👁👁
* 我会一直看着你👁👁
* 我不会干什么👁👁
* 我只是喜欢看着你而已👁👁
*/

👁👁

commented

I made some tests days ago, and found that hasIdenticalParentMethod goes wrong when checking generic types. For RecipeFilter, getGenericReturnType() will return proper return type, but for Predicate, it's returning Object when generic T is involved.

But that was days ago, I'm not quite sure if it's returnType or parameterTypes that's going wrong.

commented

This was a very hard thing to be debugged, might be a low priority since I'm currently working on other things.