Use an instanceof pattern to make the check we are making more
transparent.
Change-Id: If6d92be744e1e063f96feb7428c09c4984cf2c9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
a83dfa8d5ff23238f182283945d868ab52a13035)
}
private static StatementContextBase<?, ?, ?> contextImpl(final Object value) {
- checkArgument(value instanceof StatementContextBase, "Supplied context %s is not provided by this reactor.",
- value);
- return StatementContextBase.class.cast(value);
+ if (value instanceof StatementContextBase<?, ?, ?> impl) {
+ return impl;
+ }
+ throw new IllegalArgumentException("Supplied context " + value + " is not provided by this reactor.");
}
boolean tryApply() {