I am trying to load a method from a class with MethodInfo#loadClassAndGetMethod, but it's failing saying it didn't find the method, exception:
Exception in thread "main" java.lang.IllegalArgumentException: Method not found: com.freya02.botcommands.oldtests.ClassGraphBug.test
at io.github.classgraph.MethodInfo.loadClassAndGetMethod(MethodInfo.java:849)
at com.freya02.botcommands.oldtests.ClassGraphBug.main(ClassGraphBug.java:30)
The loading is failing because the method has a generic parameter, by debugging the internals i've found the parameter types used to find the method were wrong, if you have a single parameter which type is a generic, MethodInfo#loadParameterClasses returns the class the method is declared in, however, it should have returned the erasure of the generic parameter.
Here are the verbose logs as well as a reproducible example.
CG-logs.log
ClassGraphBug.zip
I am trying to load a method from a class with
MethodInfo#loadClassAndGetMethod, but it's failing saying it didn't find the method, exception:The loading is failing because the method has a generic parameter, by debugging the internals i've found the parameter types used to find the method were wrong, if you have a single parameter which type is a generic,
MethodInfo#loadParameterClassesreturns the class the method is declared in, however, it should have returned the erasure of the generic parameter.Here are the verbose logs as well as a reproducible example.
CG-logs.log
ClassGraphBug.zip