New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return a meaningful error when null on a primitive #92

henri-tremblay opened this Issue Jun 3, 2015 · 0 comments


None yet
1 participant

henri-tremblay commented Jun 3, 2015

Migrated from: CodeHaus issue EASYMOCK-81
Original reporter: Henri Tremblay

Currently if you accidentally write something like expect(; // foo is typed to return a boolean

you run into a seemingly surprising error message where a NullPointerException is thrown when the method is called, later, despite nothing looking like it's null.
(i.e. this line, later:
boolean b =; // throws a NullPointerException, despite a not being null

This causes some confusion and frustration.
Proposal: disallow returning null if a boolean/long/int is the return type (if that's even possible).

@henri-tremblay henri-tremblay self-assigned this Jun 3, 2015

@henri-tremblay henri-tremblay added this to the 2.5 milestone Jun 3, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment