joptsimple.internal.Reflection does not handle autoboxing #5

dyokomizo opened this Issue Aug 30, 2011 · 3 comments


None yet

2 participants


It would be nice if using parser.ofType(int.class) was equivalent to parser.ofType(Integer.class), but currently it fails because Reflection doesn't handle autoboxing.

Generics specification makes int.class and Integer.class equivalent for generic purposes (i.e. parser.ofType(int.class) is of type ArgumentAcceptingOptionSpec.


That sounds like a reasonable, simple change.

@pholser pholser added a commit that referenced this issue Aug 30, 2011
@pholser gh-5 -- Allowing classes representing primitives into ofType().
Currently char.class still bombs out, since java.lang.Character has neither a valueOf(String) method nor a one-arg String ctor. Maybe this is OK? Using ofType(Character.class) would fail before this change anyways.

If you're OK with char/Character still not counting as "value types" for purposes of option arg conversion, I think the above commit settles it. Let me know what you think.


This seems to good enough. Thanks for the fix.

@dyokomizo dyokomizo closed this Aug 31, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment