Browse Source

Use @SuppressWarnings for checkstyle suppressions & warnings

It's better to use @SuppressWarnings instead of the suppressions file, so that the warning suppression is at the place where it acts.
pull/8073/head
Stypox 5 months ago
parent
commit
53f8415e9b
No known key found for this signature in database GPG Key ID: 4BDF1B40A49FDD23
  1. 2
      app/src/main/java/org/schabi/newpipe/local/LocalItemListAdapter.java
  2. 1
      app/src/main/java/org/schabi/newpipe/player/Player.java
  3. 1
      app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItem.java
  4. 1
      app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java
  5. 1
      app/src/main/java/org/schabi/newpipe/streams/WebMWriter.java
  6. 8
      checkstyle/suppressions.xml

2
app/src/main/java/org/schabi/newpipe/local/LocalItemListAdapter.java

@ -228,6 +228,7 @@ public class LocalItemListAdapter extends RecyclerView.Adapter<RecyclerView.View
return count;
}
@SuppressWarnings("FinalParameters")
@Override
public int getItemViewType(int position) {
if (DEBUG) {
@ -300,6 +301,7 @@ public class LocalItemListAdapter extends RecyclerView.Adapter<RecyclerView.View
}
}
@SuppressWarnings("FinalParameters")
@Override
public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder, int position) {
if (DEBUG) {

1
app/src/main/java/org/schabi/newpipe/player/Player.java

@ -682,6 +682,7 @@ public final class Player implements
//////////////////////////////////////////////////////////////////////////*/
//region Playback initialization via intent
@SuppressWarnings("MethodLength")
public void handleIntent(@NonNull final Intent intent) {
// fail fast if no play queue was provided
final String queueCache = intent.getStringExtra(PLAY_QUEUE_KEY);

1
app/src/main/java/org/schabi/newpipe/player/playqueue/PlayQueueItem.java

@ -52,6 +52,7 @@ public class PlayQueueItem implements Serializable {
item.getUploaderUrl(), item.getStreamType());
}
@SuppressWarnings("ParameterNumber")
private PlayQueueItem(@Nullable final String name, @Nullable final String url,
final int serviceId, final long duration,
@Nullable final String thumbnailUrl, @Nullable final String uploader,

1
app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java

@ -142,6 +142,7 @@ public class Mp4FromDashWriter {
outStream = null;
}
@SuppressWarnings("MethodLength")
public void build(final SharpStream output) throws IOException {
if (done) {
throw new RuntimeException("already done");

1
app/src/main/java/org/schabi/newpipe/streams/WebMWriter.java

@ -121,6 +121,7 @@ public class WebMWriter implements Closeable {
clustersOffsetsSizes = null;
}
@SuppressWarnings("MethodLength")
public void build(final SharpStream out) throws IOException, RuntimeException {
if (!out.canRewind()) {
throw new IOException("The output stream must be allow seek");

8
checkstyle/suppressions.xml

@ -3,13 +3,7 @@
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
<suppressions>
<suppress checks="FinalParameters"
files="LocalItemListAdapter.java"
lines="232,304"/>
<suppress checks="EmptyBlock"
files="ContentSettingsFragment.java"
lines="227,245"/>
<!-- Use @SuppressWarnings("...") if it is possible, only use this file if it is not -->
<suppress checks="FileLength"
files="Player.java"/>

Loading…
Cancel
Save