Skip to content

Commit

Permalink
suppress unnecessary CPD violation
Browse files Browse the repository at this point in the history
`Map...View`s are practically all duplicate and very straightforward. We could technically refactor to save a few lines by converting field references to protected instance methods, but it seems unnecessary
  • Loading branch information
Jakobeha committed Jun 25, 2024
1 parent ce4d572 commit 6c8c808
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/prlprg/util/MapListView.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
@UnmodifiableView
final class MapListView<I, O> implements List<O> {
// don't care about other `Map...View` duplicated code because it's all boilerplate - CPD-OFF
private final List<I> backing;
private final Function<I, O> f;

Expand Down Expand Up @@ -195,4 +196,5 @@ public void add(O o) {
public List<O> subList(int fromIndex, int toIndex) {
return new MapListView<>(backing.subList(fromIndex, toIndex), f);
}
// don't care about other `Map...View` duplicated code because it's all boilerplate - CPD-ON
}
2 changes: 2 additions & 0 deletions src/main/java/org/prlprg/util/MapSequencedCollectionView.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*/
@UnmodifiableView
final class MapSequencedCollectionView<I, O> implements SequencedCollection<O> {
// don't care about other `Map...View` duplicated code because it's all boilerplate - CPD-OFF
private final SequencedCollection<I> backing;
private final Function<I, O> f;

Expand Down Expand Up @@ -187,4 +188,5 @@ public void clear() {
}
};
}
// don't care about other `Map...View` duplicated code because it's all boilerplate - CPD-ON
}

0 comments on commit 6c8c808

Please sign in to comment.