method filtering for parameterized interfaces seems not working at all
ZZZank opened this issue · 3 comments
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.
ProbeJS/common/src/main/java/moe/wolfgirl/next/java/clazz/Clazz.java
Lines 119 to 133 in a9fe3bf
ProbeJS/common/src/main/java/moe/wolfgirl/next/java/clazz/Clazz.java
Lines 150 to 159 in a9fe3bf
👁👁
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.