mercredi 4 octobre 2017

Is Lombok Compatible with .getConstructor()?

I'm trying to use reflection to call the constructor generated by Lombok using @RequiredArgsConstructor (with no staticName param).

Class.forName("path.to.class")
                    .getConstructor(classes)
                    .newInstance(params);

but I get a java.lang.NoSuchMethodException error. Using .getDeclaredMethod() instead of .getConstructor() works for any of the other methods, but not a constructor of the same name as the class.

Does Lombok generate some weird constructor that is not recognized by .getConstructor()?





Aucun commentaire:

Enregistrer un commentaire