@@ -47,6 +47,13 @@ public TestClass(Class<?> klass) {
47
47
Map <Class <? extends Annotation >, List <FrameworkField >> fieldsForAnnotations =
48
48
new LinkedHashMap <Class <? extends Annotation >, List <FrameworkField >>();
49
49
50
+ scanAnnotatedMembers (methodsForAnnotations , fieldsForAnnotations );
51
+
52
+ fMethodsForAnnotations = makeDeeplyUnmodifiable (methodsForAnnotations );
53
+ fFieldsForAnnotations = makeDeeplyUnmodifiable (fieldsForAnnotations );
54
+ }
55
+
56
+ protected void scanAnnotatedMembers (Map <Class <? extends Annotation >, List <FrameworkMethod >> methodsForAnnotations , Map <Class <? extends Annotation >, List <FrameworkField >> fieldsForAnnotations ) {
50
57
for (Class <?> eachClass : getSuperClasses (fClass )) {
51
58
for (Method eachMethod : MethodSorter .getDeclaredMethods (eachClass )) {
52
59
addToAnnotationLists (new FrameworkMethod (eachMethod ), methodsForAnnotations );
@@ -57,9 +64,6 @@ public TestClass(Class<?> klass) {
57
64
addToAnnotationLists (new FrameworkField (eachField ), fieldsForAnnotations );
58
65
}
59
66
}
60
-
61
- fMethodsForAnnotations = makeDeeplyUnmodifiable (methodsForAnnotations );
62
- fFieldsForAnnotations = makeDeeplyUnmodifiable (fieldsForAnnotations );
63
67
}
64
68
65
69
private static Field [] getSortedDeclaredFields (Class <?> clazz ) {
@@ -72,7 +76,7 @@ public int compare(Field field1, Field field2) {
72
76
return declaredFields ;
73
77
}
74
78
75
- private static <T extends FrameworkMember <T >> void addToAnnotationLists (T member ,
79
+ protected static <T extends FrameworkMember <T >> void addToAnnotationLists (T member ,
76
80
Map <Class <? extends Annotation >, List <T >> map ) {
77
81
for (Annotation each : member .getAnnotations ()) {
78
82
Class <? extends Annotation > type = each .annotationType ();
0 commit comments