NoSuchMethodException using reflection

I doubt Class::getDeclaredMethod() is able to find methods that a class inherited from any of its parents: :cold_sweat:
Docs.Oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html#getDeclaredMethod(java.lang.String,java.lang.Class...)

Instead, method colorCalc() is found declared inside class PGraphics: :world_map:

And not in any of its subclasses: :woozy_face:

Therefore, you’re gonna need to use PGraphics.class in place of g.getClass(). :nerd_face:

1 Like