JingGe commented on a change in pull request #18333:
URL: https://github.com/apache/flink/pull/18333#discussion_r783968568
##########
File path:
flink-architecture-tests/src/test/java/org/apache/flink/architecture/common/Predicates.java
##########
@@ -40,7 +51,29 @@
.forSubtype();
}
- /** Tests that the given field is {@code public static} and of the given
type. */
+ /**
+ * @return A {@link DescribedPredicate} returning true, if and only if the
predicate {@link
+ * JavaField} could be found in the {@link JavaClass}.
+ */
+ public static DescribedPredicate<JavaClass>
containAnyFieldsInClassHierarchyThat(
+ DescribedPredicate<? super JavaField> predicate) {
+ return new ContainAnyFieldsThatPredicate<>(
+ "fields",
+ new ChainableFunction<JavaClass, Set<JavaField>>() {
+ @Override
+ public Set<JavaField> apply(JavaClass input) {
+ // need to get all fields with the inheritance
hierarchy
+ return input.getAllFields();
+ }
+ },
+ predicate);
+ }
+
+ /**
+ * Tests that the given field is {@code public static} and of the given
type {@code clazz} .
+ *
+ * <p>Attention: changing the description will add a rule into the
stored.rules.
Review comment:
I wanted to change this method created by you to follow the concept I
did with other methods I created and realised that ArchUnit is using the
description as the key to define the stored.rule, which means any change of the
description of exist rule will need to hack the stored.rule manually.
Therefore, I just let this method unchanged and wrote the hint in the java doc.
I think ArchUnit should improve this part and this is beyond the scope of this
PR.
--
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]