[PROPOSAL][JDK10] Introduce Executable.getParameterType(index)
Christoph Dreis
christoph.dreis at freenet.de
Mon Oct 23 11:06:03 UTC 2017
Hey Claes,
thank you for your comments on my proposal.
> > public Class<?> getParameterType(int index) {
> > if (index < 0 || index > getParameterCount()) {
> > throw new IndexOutOfBoundsException("No parameter found
> > on index " + index);
> > }
>
> I don't think we need the explicit range check here.
I thought about that, but decided against the specific ArrayIndexOutOfBoundsException which would be thrown if we omit the explicit check. My reasoning behind that was that the API should not expose the fact that it's working with an array underneath. I have no strong feelings against your comment, though. I'd be fine with both solutions.
> All in all I think it can pull its weight by allowing us to reduce JDK internal use
> of getParameterTypes() alone, thus I'm in favor and can volunteer to sponsor
> (this will need a CSR etc..)
Anything I can do to help?
Cheers,
Christoph
More information about the core-libs-dev
mailing list