Closed GoogleCodeExporter closed 9 years ago
Is there any way to reproduce this without the raw types?
Original comment by wasserman.louis
on 11 Apr 2014 at 4:06
This test was first auto-generated and then manually reduced by us. I am afraid
I am not sure how to simplify it further.
Original comment by cyrille....@gmail.com
on 11 Apr 2014 at 4:28
Have you looked at the stack traces of these NPEs? In both cases, the NPE
happens because you're passing a Class that is _not_ an enum class to a method
that requires a Class<E extends Enum<E>>. It isn't possible to do that without
using raw types, and if you're using raw types any guarantees of safety go
right out the window.
Original comment by cgdecker@google.com
on 11 Apr 2014 at 3:37
I see. How about inserting a type check in a few places such that the exception
is IllegalArgumentException or ClassCastException? That would be clearer to the
user, as no null pointer is used to produce the bug. (Of course each type check
adds some overhead; I'll leave it up to you to prioritize performance vs. ease
of use here.)
Original comment by cyrille....@gmail.com
on 13 Apr 2014 at 11:49
I don't think it's worth making code changes to prevent against problems that
are already prevented by simply obeying the compiler warnings you're already
getting.
Original comment by kevinb@google.com
on 14 Apr 2014 at 1:48
OK, then we count this test as a false warning.
Original comment by cyrille....@gmail.com
on 14 Apr 2014 at 2:20
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:09
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:07
Original issue reported on code.google.com by
cyrille....@gmail.com
on 11 Apr 2014 at 3:59Attachments: