Why does .getConstructor fail with a NoSuchMethodException despite zero-arg constructors existing for the class?

Thanks so much, that solved it. I now also added

final PApplet sketch = this;

to the top and changed the method code to

Ingredient ingredient = ingredientClass.getDeclaredConstructor(sketchClass).newInstance(sketch);

and finally it works! Thanks a lot to you too @quark, you already got me on the right track with the last post of yours.

1 Like