On my current project, I\'ve felt the need to create a sort of simulated callback system in Java using reflection. However, I\'m having issues getting my reflection to actua
The versioning issue that can cause NoSuchMethodException isn't a difference between the compiler versions. It's a difference in the version of (in your case) MyClass
at compile time versus runtime.
Since you're using reflection you issue might have nothing to do with versioning, though. Certainly that would not explain different behavior between getMethod
and getDeclaredMethods
, because you're running them against the same Class instance, hence a version difference isn't really possible.
Are you sure that the parameters match your actual method?