Skip to content
This repository has been archived by the owner on Oct 13, 2020. It is now read-only.

Confusing error with ParameterSupplier #23

Open
leeavital opened this issue Oct 31, 2016 · 3 comments
Open

Confusing error with ParameterSupplier #23

leeavital opened this issue Oct 31, 2016 · 3 comments

Comments

@leeavital
Copy link

I hit this error message when:

https://github.com/junit-team/junit.contrib/blob/master/theories/src/main/java/org/junit/contrib/theories/Theories.java#L88

  • my supplier class had default visibility instead of public
  • my supplier class had a declared no-args constructor

Would it make sense to change the message to "Supplier class X must not declare a constructor and must be public" ?

@marcphilipp
Copy link
Member

@pholser Can you take a look, please?

@pholser
Copy link
Contributor

pholser commented Nov 1, 2016

@leeavital What about changing the message to:

Supplier class X needs a single public constructor

If your class is marked public but declares no ctors, then X.class.getConstructors() gives a one-element array; this element is the free public zero-arg ctor you get when you declare no constructors.

@leeavital
Copy link
Author

I'm pretty sure I got this error even when I had a single no-args constructor declared. I don't have a good reproduction at the moment though

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants