Skip to content

Commit

Permalink
code review feedback: reduce scope of the 'unchecked cast' warning fi…
Browse files Browse the repository at this point in the history
…x a.k.a. @SuppressWarnings('unchecked')
  • Loading branch information
cpoerschke committed Dec 31, 2021
1 parent 45be4ae commit 43df829
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/org/junit/runners/model/FrameworkMember.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ public abstract class FrameworkMember<T extends FrameworkMember<T>> implements
Annotatable {
abstract boolean isShadowedBy(T otherMember);

@SuppressWarnings("unchecked")
T handlePossibleBridgeMethod(List<T> members) {
for (int i = members.size() - 1; i >=0; i--) {
T otherMember = members.get(i);
Expand All @@ -31,7 +30,11 @@ T handlePossibleBridgeMethod(List<T> members) {
}
}
// No shadow or bridge method found. The caller should add *this* member.
return (T) this;
FrameworkMember<? extends T> thisMember = this;
@SuppressWarnings("unchecked")
T result = (T) thisMember;

return result;
}

abstract boolean isBridgeMethod();
Expand Down

0 comments on commit 43df829

Please sign in to comment.