maedhroz commented on code in PR #3241:
URL: https://github.com/apache/cassandra/pull/3241#discussion_r1563691881
##########
test/anttasks/org/apache/cassandra/anttasks/TestNameCheckTask.java:
##########
@@ -158,14 +161,21 @@ private Class<?> normalize(Class<?> klass)
*/
private Stream<? extends Class<?>> expand(Class<?> klass, Reflections
reflections)
{
- Set<? extends Class<?>> subTypes = reflections.getSubTypesOf(klass);
- if (subTypes == null || subTypes.isEmpty())
- return Stream.of(klass);
- Stream<? extends Class<?>> subs = subTypes.stream();
- // assume we include if not abstract
- if (!Modifier.isAbstract(klass.getModifiers()))
- subs = Stream.concat(Stream.of(klass), subs);
- return subs;
+ Set<Class<?>> concreteTypes = new HashSet<>();
+ Deque<Class<?>> typeStack = new ArrayDeque<>();
+ typeStack.push(klass);
+
+ while (!typeStack.isEmpty())
+ {
+ Class<?> type = typeStack.pop();
+
+ if (!Modifier.isAbstract(type.getModifiers()))
+ concreteTypes.add(type);
+
+ reflections.getSubTypesOf(type).forEach(typeStack::push);
+ }
+
+ return concreteTypes.stream();
Review Comment:
@jacek-lewandowski @smiklosovic This was causing issues for
`ValueThresholdTester`, which is a subclass of `ThresholdTester` but is also
`abstract`. Basically we can handle more than one level of inheritance now.
WDYT?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]