86 Constructor[] constructors = c.getConstructors();
87 for (Constructor constr : constructors) {
88 check(constr.getGenericParameterTypes(), "parameter",
89 "constructor " + constr);
90 check(constr.getTypeParameters(), "type parameter",
91 "constructor " + constr);
92 }
93
94 Class<?>[] inners = c.getDeclaredClasses();
95 for (Class inner : inners)
96 checkClass(inner);
97 }
98
99 private static void check(Type[] types, String elementKind, String what) {
100 for (int i = 0; i < types.length; i++) {
101 Type t = types[i];
102 check(t, elementKind + " " + (i+1) + " of " + what);
103 }
104 }
105
106 private static final Set<Type> checking = new HashSet<Type>();
107
108 private static void check(Type t, String what) {
109 if (t == null || !checking.add(t))
110 return;
111 // Avoid infinite recursion. t can be null e.g. for superclass of Object.
112 try {
113 check2(t, what);
114 } finally {
115 checking.remove(t);
116 }
117 }
118
119 private static void check2(Type t, String what) {
120 if (t instanceof ParameterizedType) {
121 ParameterizedType pt = (ParameterizedType) t;
122 check(pt.getActualTypeArguments(), "type argument", what);
123 } else if (t instanceof TypeVariable) {
124 TypeVariable<?> tv = (TypeVariable<?>) t;
125 check(tv.getBounds(), "bound", what);
126 GenericDeclaration gd = tv.getGenericDeclaration();
|
86 Constructor[] constructors = c.getConstructors();
87 for (Constructor constr : constructors) {
88 check(constr.getGenericParameterTypes(), "parameter",
89 "constructor " + constr);
90 check(constr.getTypeParameters(), "type parameter",
91 "constructor " + constr);
92 }
93
94 Class<?>[] inners = c.getDeclaredClasses();
95 for (Class inner : inners)
96 checkClass(inner);
97 }
98
99 private static void check(Type[] types, String elementKind, String what) {
100 for (int i = 0; i < types.length; i++) {
101 Type t = types[i];
102 check(t, elementKind + " " + (i+1) + " of " + what);
103 }
104 }
105
106 private static final Set<Type> checking = new HashSet<>();
107
108 private static void check(Type t, String what) {
109 if (t == null || !checking.add(t))
110 return;
111 // Avoid infinite recursion. t can be null e.g. for superclass of Object.
112 try {
113 check2(t, what);
114 } finally {
115 checking.remove(t);
116 }
117 }
118
119 private static void check2(Type t, String what) {
120 if (t instanceof ParameterizedType) {
121 ParameterizedType pt = (ParameterizedType) t;
122 check(pt.getActualTypeArguments(), "type argument", what);
123 } else if (t instanceof TypeVariable) {
124 TypeVariable<?> tv = (TypeVariable<?>) t;
125 check(tv.getBounds(), "bound", what);
126 GenericDeclaration gd = tv.getGenericDeclaration();
|