-
First, thanks for such an awesome library! I'm working on an API that allows method chaining and I have the following use case: interface Base {
Base baseOp();
}
interface Foo extends Base {
@Override
Foo baseOp(); // returns Foo instead of Base
Foo fooOp();
}
interface Bar extends Base {
@Override
Bar baseOp(); // returns Bar instead of Base
Bar barOp();
} How can I verify that |
Beta Was this translation helpful? Give feedback.
Answered by
hankem
Jan 23, 2023
Replies: 1 comment 1 reply
-
For now, you could define a custom check similar to the one that is currently being developed in #1040: public boolean isOverridden(JavaMethod method) {
return Stream.concat(method.getOwner().getAllRawSuperclasses().stream(), method.getOwner().getAllRawInterfaces().stream())
.map(JavaClass::getAllMethods)
.flatMap(Set<JavaMethod>::stream)
.anyMatch(superMethod ->
superMethod.getName().equals(method.getName()) &&
superMethod.getParameterTypes().equals(method.getParameterTypes())
);
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
armandino
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For now, you could define a custom check similar to the one that is currently being developed in #1040: