equal
deleted
inserted
replaced
|
1 This is the community's fix for using Java 8. |
|
2 Community bug: |
|
3 https://github.com/junit-team/junit/issues/749 |
|
4 Community code: |
|
5 https://github.com/stefanbirkner/junit/commit/69de4c23996fe320e8345f273e2e35e529f0fdf3 |
|
6 |
|
7 |
|
8 --- junit-r4.11/src/main/java/org/junit/internal/MethodSorter.java.orig Thu Oct 9 11:09:18 2014 |
|
9 +++ junit-r4.11/src/main/java/org/junit/internal/MethodSorter.java Thu Oct 9 11:14:09 2014 |
|
10 @@ -1,8 +1,10 @@ |
|
11 package org.junit.internal; |
|
12 |
|
13 import java.lang.reflect.Method; |
|
14 -import java.util.Arrays; |
|
15 +import java.util.ArrayList; |
|
16 +import java.util.Collections; |
|
17 import java.util.Comparator; |
|
18 +import java.util.List; |
|
19 |
|
20 import org.junit.FixMethodOrder; |
|
21 |
|
22 @@ -52,11 +54,16 @@ |
|
23 Comparator<Method> comparator = getSorter(clazz.getAnnotation(FixMethodOrder.class)); |
|
24 |
|
25 Method[] methods = clazz.getDeclaredMethods(); |
|
26 + List<Method> x = new ArrayList<Method>(); |
|
27 + for (Method method : methods) |
|
28 + if (!method.isBridge() && !method.isSynthetic()) |
|
29 + x.add(method); |
|
30 + |
|
31 if (comparator != null) { |
|
32 - Arrays.sort(methods, comparator); |
|
33 + Collections.sort(x, comparator); |
|
34 } |
|
35 |
|
36 - return methods; |
|
37 + return x.toArray(new Method[x.size()]); |
|
38 } |
|
39 |
|
40 private MethodSorter() { |