RFR (S): JDK-8039916: AnnotatedType.getType() of a Executable parameters may return wrong type
Paul Sandoz
paul.sandoz at oracle.com
Wed Jun 4 10:25:29 UTC 2014
On Jun 3, 2014, at 1:48 PM, Joel Borggrén-Franck <joel.franck at oracle.com> wrote:
> Hi
>
> Can I get a review for this small fix for https://bugs.openjdk.java.net/browse/JDK-8039916
>
> Webrev here: http://cr.openjdk.java.net/~jfranck/8039916/webrev.01/
>
> Since this is the second issue like this found recently I created a rather large test to see if there are any more lurking issues. I found one more, see: https://bugs.openjdk.java.net/browse/JDK-8044629 .I need to figure out what the right behavior for the new issue, is so I need to delay that fix.
>
Looks good.
You might consider the following a more streamy way, not tested! up to you :-)
private static Object[][] provider() {
Stream<? extends Executable> s = filterData(Test.class.getMethods(), null);
s = Stream.concat(s, filterData(Test.class.getConstructors(), null));
s = Stream.concat(s, filterData(Test.class.getConstructors(), null));
return streamToArray(s);
}
private static Stream<? extends Executable> filterData(Executable[] es, Class<?> c) {
return Stream.of(es).filter(m -> m.getDeclaringClass() == c);
}
private static Object[][] streamToArray(Stream<?> s) {
return s.map(e -> Stream.of(e).toArray()).toArray(Object[][]::new);
}
Paul.
More information about the core-libs-dev
mailing list